fetchgit: Track all remote branches when `$rev' is non-empty.
svn path=/nixpkgs/trunk/; revision=21892
This commit is contained in:
parent
e7521238ae
commit
8ccb0fda33
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user