diff options
author | Florian Friesdorf <flo@chaoflow.net> | 2011-06-22 19:34:27 +0000 |
---|---|---|
committer | Florian Friesdorf <flo@chaoflow.net> | 2011-06-22 19:34:27 +0000 |
commit | ee731974e93a65985781307ceedeb8cda0702166 (patch) | |
tree | 5f7673f380adcc505410faf33a0db96da6f1a8f9 /pkgs/build-support | |
parent | edd3c491191d5c035cec06c61aaafabba5fd59e8 (diff) | |
download | nixlib-ee731974e93a65985781307ceedeb8cda0702166.tar nixlib-ee731974e93a65985781307ceedeb8cda0702166.tar.gz nixlib-ee731974e93a65985781307ceedeb8cda0702166.tar.bz2 nixlib-ee731974e93a65985781307ceedeb8cda0702166.tar.lz nixlib-ee731974e93a65985781307ceedeb8cda0702166.tar.xz nixlib-ee731974e93a65985781307ceedeb8cda0702166.tar.zst nixlib-ee731974e93a65985781307ceedeb8cda0702166.zip |
fetchgit builder to handle broken remotes without a HEAD
svn path=/nixpkgs/trunk/; revision=27521
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/fetchgit/builder.sh | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/pkgs/build-support/fetchgit/builder.sh b/pkgs/build-support/fetchgit/builder.sh index 7e363911bac1..558e946d76cf 100644 --- a/pkgs/build-support/fetchgit/builder.sh +++ b/pkgs/build-support/fetchgit/builder.sh @@ -1,3 +1,6 @@ +# tested so far with: +# - no revision specified and remote has a HEAD which is used +# - revision specified and remote has a HEAD source $stdenv/setup header "exporting $url (rev $rev) into $out" @@ -6,10 +9,8 @@ git init $out cd $out git remote add origin "$url" git fetch origin -git remote set-head origin -a - -# If no revision was specified, the remote HEAD will be used -git checkout -b __nixos_build__ origin/HEAD +git remote set-head origin -a || ( + test -n $rev && echo "that's ok, we want $rev" || exit 1) if test -n "$rev"; then echo "Trying to checkout: $rev" @@ -18,6 +19,9 @@ if test -n "$rev"; then git rev-parse --verify origin/"$rev" 2>/dev/null ) git reset --hard $parsed_rev + git checkout -b __nixos_build__ +else + git checkout -b __nixos_build__ origin/HEAD fi if test -z "$leaveDotGit"; then |