Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-11-02 09:19:36 +0300
committerJunio C Hamano <junkio@cox.net>2005-11-02 09:19:36 +0300
commite125c1a717bb732319596d8b792a67c2b7b15ef7 (patch)
treeb774cd64105bda561bba3c528a7fea19b87755a1 /git-clone.sh
parente5215804ded0102f6d6f3d694374ae5e106fd9c0 (diff)
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>
Diffstat (limited to 'git-clone.sh')
-rwxr-xr-xgit-clone.sh15
1 files changed, 11 insertions, 4 deletions
diff --git a/git-clone.sh b/git-clone.sh
index 18e692a67b..c27a913b1d 100755
--- a/git-clone.sh
+++ b/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