aboutsummaryrefslogtreecommitdiff
path: root/git-clone.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-03-21 01:58:26 -0800
committerJunio C Hamano <junkio@cox.net>2006-03-21 02:02:46 -0800
commit5ceb05f82edc49ad5e6b0ad98d633c124a567309 (patch)
tree4cfe6fe2d78aa39a8c5683ed42b3eba9a19459c0 /git-clone.sh
parent47874d6d9a7f49ade6388df049597f03365961ca (diff)
downloadgit-5ceb05f82edc49ad5e6b0ad98d633c124a567309.tar.gz
git-5ceb05f82edc49ad5e6b0ad98d633c124a567309.tar.xz
clone: record the remote primary branch with remotes/$origin/HEAD
This matches c51d13692d4e451c755dd7da3521c5db395df192 commit to record the primary branch of the remote with a symbolic ref remotes/$origin/HEAD. The user can later change it to point at different branch to change the meaning of "$origin" shorthand. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-clone.sh')
-rwxr-xr-xgit-clone.sh12
1 files changed, 9 insertions, 3 deletions
diff --git a/git-clone.sh b/git-clone.sh
index 3b5475340..5953e18a5 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -45,7 +45,7 @@ Perhaps git-update-server-info needs to be run there?"
if test -n "$use_separate_remote" &&
branch_name=`expr "$name" : 'heads/\(.*\)'`
then
- tname="remotes/$branch_name"
+ tname="remotes/$origin/$branch_name"
else
tname=$name
fi
@@ -370,7 +370,7 @@ then
Pull: refs/heads/$head_points_at:refs/$origin_tracking" &&
case "$use_separate_remote" in
t) git-update-ref HEAD "$head_sha1" ;;
- *) git-update-ref "refs/$origin" $(git-rev-parse HEAD)
+ *) git-update-ref "refs/$origin" $(git-rev-parse HEAD) ;;
esac &&
(cd "$GIT_DIR/$remote_top" && find . -type f -print) |
while read dotslref
@@ -379,7 +379,13 @@ Pull: refs/heads/$head_points_at:refs/$origin_tracking" &&
test "$head_points_at" = "$name" ||
test "$origin" = "$head" ||
echo "Pull: refs/heads/${name}:$remote_top/${name}"
- done >>"$GIT_DIR/remotes/$origin"
+ done >>"$GIT_DIR/remotes/$origin" &&
+ case "$use_separate_remote" in
+ t)
+ rm -f "refs/remotes/$origin/HEAD"
+ git-symbolic-ref "refs/remotes/$origin/HEAD" \
+ "refs/remotes/$origin/$head_points_at"
+ esac
esac
case "$no_checkout" in