Skip to content

Commit

Permalink
fetchgit: support "git@server:repo" URLs
Browse files Browse the repository at this point in the history
Update the code that extracts the base name from a git repo URL so that
it can deal with URLs like "git@server:repo".
  • Loading branch information
bjornfor committed Jun 24, 2017
1 parent 909fb24 commit b8658f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pkgs/build-support/fetchgit/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{stdenv, git, cacert}: let
urlToName = url: rev: let
base = baseNameOf (stdenv.lib.removeSuffix "/" url);
inherit (stdenv.lib) removeSuffix splitString last;
base = last (splitString ":" (baseNameOf (removeSuffix "/" url)));

matched = builtins.match "(.*).git" base;

Expand Down
3 changes: 1 addition & 2 deletions pkgs/build-support/fetchgit/nix-prefetch-git
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,8 @@ hash_from_ref(){
url_to_name(){
local url=$1
local ref=$2
# basename removes the / and .git suffixes
local base
base=$(basename "$url" .git)
base=$(basename "$url" .git | cut -d: -f2)

if [[ $ref =~ ^[a-z0-9]+$ ]]; then
echo "$base-${ref:0:7}"
Expand Down

0 comments on commit b8658f6

Please sign in to comment.