mirror of
https://github.com/git/git
synced 2024-08-28 12:09:19 +00:00
git-clone: do not forget to create origin branch.
The newly cloned repository by default had .git/remotes/origin set up to track the remote master to origin, but forgot to create the origin branch ourselves. Also it hardcoded the assumption that the remote HEAD points at "master", which may not always be true. Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
e5215804de
commit
e125c1a717
15
git-clone.sh
15
git-clone.sh
|
@ -196,10 +196,17 @@ cd $D || exit
|
|||
|
||||
if test -f ".git/HEAD"
|
||||
then
|
||||
mkdir -p .git/remotes || exit
|
||||
echo >.git/remotes/origin \
|
||||
"URL: $repo
|
||||
Pull: master:origin"
|
||||
head_points_at=`git-symbolic-ref HEAD`
|
||||
case "$head_points_at" in
|
||||
refs/heads/*)
|
||||
head_points_at=`expr "$head_points_at" : 'refs/heads/\(.*\)'`
|
||||
mkdir -p .git/remotes &&
|
||||
echo >.git/remotes/origin \
|
||||
"URL: $repo
|
||||
Pull: $head_points_at:origin"
|
||||
cp ".git/refs/heads/$head_points_at" .git/refs/heads/origin
|
||||
esac
|
||||
|
||||
case "$no_checkout" in
|
||||
'')
|
||||
git checkout
|
||||
|
|
Loading…
Reference in a new issue