diff options
author | Bjørn Forsman <bjorn.forsman@gmail.com> | 2017-06-18 13:42:39 +0200 |
---|---|---|
committer | Bjørn Forsman <bjorn.forsman@gmail.com> | 2017-06-24 14:34:08 +0200 |
commit | b8658f629b598d9a5bb0acba2421e0ad99f67847 (patch) | |
tree | 28fb59de04a2a35844de15dfaf55e3f67c1e14c6 /pkgs/build-support/fetchgit | |
parent | 909fb246fdecc4703772dcafed8044b30c037b8d (diff) |
fetchgit: support "git@server:repo" URLs
Update the code that extracts the base name from a git repo URL so that it can deal with URLs like "git@server:repo".
Diffstat (limited to 'pkgs/build-support/fetchgit')
-rw-r--r-- | pkgs/build-support/fetchgit/default.nix | 3 | ||||
-rwxr-xr-x | pkgs/build-support/fetchgit/nix-prefetch-git | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/pkgs/build-support/fetchgit/default.nix b/pkgs/build-support/fetchgit/default.nix index a5f81ef17940d..8e060b87ebd30 100644 --- a/pkgs/build-support/fetchgit/default.nix +++ b/pkgs/build-support/fetchgit/default.nix @@ -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; diff --git a/pkgs/build-support/fetchgit/nix-prefetch-git b/pkgs/build-support/fetchgit/nix-prefetch-git index 3d656eba5fff7..9e4f346f7a525 100755 --- a/pkgs/build-support/fetchgit/nix-prefetch-git +++ b/pkgs/build-support/fetchgit/nix-prefetch-git @@ -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}" |