diff options
author | Ludovic Courtès <ludo@gnu.org> | 2010-05-19 21:27:01 +0000 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2010-05-19 21:27:01 +0000 |
commit | 8ccb0fda332ac46eaf4a821813c13f50b895a84f (patch) | |
tree | 333daf0dfe34ed64980a27c3606de243cd437de8 | |
parent | e7521238ae2c1643705ed0fa8e7442f45cb35487 (diff) | |
download | nixlib-8ccb0fda332ac46eaf4a821813c13f50b895a84f.tar nixlib-8ccb0fda332ac46eaf4a821813c13f50b895a84f.tar.gz nixlib-8ccb0fda332ac46eaf4a821813c13f50b895a84f.tar.bz2 nixlib-8ccb0fda332ac46eaf4a821813c13f50b895a84f.tar.lz nixlib-8ccb0fda332ac46eaf4a821813c13f50b895a84f.tar.xz nixlib-8ccb0fda332ac46eaf4a821813c13f50b895a84f.tar.zst nixlib-8ccb0fda332ac46eaf4a821813c13f50b895a84f.zip |
fetchgit: Track all remote branches when `$rev' is non-empty.
svn path=/nixpkgs/trunk/; revision=21892
-rw-r--r-- | pkgs/build-support/fetchgit/builder.sh | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/pkgs/build-support/fetchgit/builder.sh b/pkgs/build-support/fetchgit/builder.sh index ba06aed90e18..794b690341e3 100644 --- a/pkgs/build-support/fetchgit/builder.sh +++ b/pkgs/build-support/fetchgit/builder.sh @@ -5,7 +5,16 @@ header "exporting $url (rev $rev) into $out" git clone "$url" $out if test -n "$rev"; then cd $out - git checkout $rev + + # Track all remote branches so that revisions like + # `t/foo@{2010-05-12}' are correctly resolved. Failing to do that, + # Git bails out with an "invalid reference" error. + for branch in $(git branch -rl | grep -v ' origin/master$') + do + git branch --track "$(echo $branch | sed -es,origin/,,g)" "$branch" + done + + git checkout "$rev" -- fi if test -z "$leaveDotGit"; then |