Git clone behave strange after active branch change in bare repo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I'm trying to change active branch on bare repository to force
checkout of different branch than master when directory is cloned. The
git version I'm using is  1.7.9.1 from debian repository.

I've used git-symbolic-ref to change active branch without problem:

$ cd repository.git
$ git branch
* master
$ git branch a_branch
$ git symbolic-ref HEAD refs/heads/a_branch
$ cat HEAD
ref: refs/heads/a_branch

When I run git clone while 'master' and 'a_branch' point to same
commit, I will get clone with default branch 'master' where I would
expect default branch 'a_branch'.

$ cd .. && git clone repository.git repo
$ cd repo && git branch
* master

I've tried to remove master branch and I've got result I've expected -
new clone has one branch checked out, the 'a_branch'.
But then I created another branch on the commit pointed by active
branch and tried to clone:

$ cd repository.git && git branch AAA
$ cd .. && git clone repository.git
$ cd repo && git branch
* AAA

I did few more checks and it seems to me that:

* when active branch is 'master' then default branch in clone is
always master as expected
* when active branch is different from 'master', then the default
branch in clone is a first branch in alfabetically sorted list of
branches that point to same commit as active branch

Is this behaviour correct or did I run into a bug?

Regards,
Zdenek Crha
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]