@matheusbsbs / matheus-bagliano / commits / 5ceb05f82e
Fork 0

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>

Junio C Hamano committed Mar 21, 2006 at 01:58 UTC 5ceb05f82edc49ad5e6b0ad98d633c124a567309
1 file changed +9 -3
git-clone.sh
+9 -3
@@ -45,7 +45,7 @@ Perhaps git-update-server-info needs to be run there?"
45 if test -n "$use_separate_remote" &&
46 branch_name=`expr "$name" : 'heads/\(.*\)'`
47 then
48 - tname="remotes/$branch_name"
48 + tname="remotes/$origin/$branch_name"
49 else
50 tname=$name
51 fi
@@ -370,7 +370,7 @@ then
370 Pull: refs/heads/$head_points_at:refs/$origin_tracking" &&
371 case "$use_separate_remote" in
372 t) git-update-ref HEAD "$head_sha1" ;;
373 - *) git-update-ref "refs/$origin" $(git-rev-parse HEAD)
373 + *) git-update-ref "refs/$origin" $(git-rev-parse HEAD) ;;
374 esac &&
375 (cd "$GIT_DIR/$remote_top" && find . -type f -print) |
376 while read dotslref
@@ -379,7 +379,13 @@ Pull: refs/heads/$head_points_at:refs/$origin_tracking" &&
379 test "$head_points_at" = "$name" ||
380 test "$origin" = "$head" ||
381 echo "Pull: refs/heads/${name}:$remote_top/${name}"
382 - done >>"$GIT_DIR/remotes/$origin"
382 + done >>"$GIT_DIR/remotes/$origin" &&
383 + case "$use_separate_remote" in
384 + t)
385 + rm -f "refs/remotes/$origin/HEAD"
386 + git-symbolic-ref "refs/remotes/$origin/HEAD" \
387 + "refs/remotes/$origin/$head_points_at"
388 + esac
389 esac
390
391 case "$no_checkout" in