Skip to content

Commit d293b28

Browse files
author
Junio C Hamano
committed
Merge branch 'jc/clone' into next
* jc/clone: clone: record the remote primary branch with remotes/$origin/HEAD
2 parents 5a6696a + 5ceb05f commit d293b28

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

git-clone.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Perhaps git-update-server-info needs to be run there?"
4545
if test -n "$use_separate_remote" &&
4646
branch_name=`expr "$name" : 'heads/\(.*\)'`
4747
then
48-
tname="remotes/$branch_name"
48+
tname="remotes/$origin/$branch_name"
4949
else
5050
tname=$name
5151
fi
@@ -370,7 +370,7 @@ then
370370
Pull: refs/heads/$head_points_at:refs/$origin_tracking" &&
371371
case "$use_separate_remote" in
372372
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) ;;
374374
esac &&
375375
(cd "$GIT_DIR/$remote_top" && find . -type f -print) |
376376
while read dotslref
@@ -379,7 +379,13 @@ Pull: refs/heads/$head_points_at:refs/$origin_tracking" &&
379379
test "$head_points_at" = "$name" ||
380380
test "$origin" = "$head" ||
381381
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
383389
esac
384390

385391
case "$no_checkout" in

0 commit comments

Comments
 (0)