Git development
 help / color / mirror / Atom feed
* Change default branch name (server side) while cloning a repository
@ 2015-03-27 12:27 Garbageyard
  2015-03-27 14:27 ` Stefan Näwe
  2015-03-27 16:40 ` Matthieu Moy
  0 siblings, 2 replies; 5+ messages in thread
From: Garbageyard @ 2015-03-27 12:27 UTC (permalink / raw)
  To: git

We use Gitolite for access control and i have admin access on Git server. I
wanted to make sure that whenever a new repository is created and is then
cloned on any machine, the default branch should point to mainline. To do
this, when I run the repository creation script, i change the content of
file HEAD of a given repository to point to mainline i.e., default entry of
“ref: refs/heads/master” in file HEAD is changed to “ref:
refs/heads/mainline”.

For example, if "work" is the repository name, then on Git server,

[gitolite@gitserver  repositories]$ cd work.git/

[gitolite@gitserver  work.git]$ cat HEAD
ref: refs/heads/mainline

If i now clone the repository on my local machine, then the default branch
should be pointing to mainline and not master. However, the issue is that it
still points to master. Am I /wrong/ in assuming that changing the entry in
file HEAD for a given repository on Git server will change the default
branch while cloning? If I’m wrong, can anyone please tell me how can I
enforce this change on the /server/ side correctly?




--
View this message in context: http://git.661346.n2.nabble.com/Change-default-branch-name-server-side-while-cloning-a-repository-tp7627964.html
Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: Change default branch name (server side) while cloning a repository
@ 2015-03-29  7:33 Gaurav Chhabra
  0 siblings, 0 replies; 5+ messages in thread
From: Gaurav Chhabra @ 2015-03-29  7:33 UTC (permalink / raw)
  To: git

@Stefan: Thanks for letting me know the version you tried on.

I have the following:
Gitolite version: gitolite3 v3.04-13-gcc9727c-dt on git 1.7.1
Git server version: git version 1.7.1
Git client version: git version 1.9.4.msysgit.2

My Git server version lags quite behind compared to yours. :) Clone of
any repository is not empty because i create non-empty directories
while creating any repository.

@Matthieu: You were right in saying that client can get confused if
several branches point to same commit. :)  Thank a ton! :) Going by
what Jeff mentioned confidently, my server version (1.7.1) indeed has
that flaw.

@Jeff: You've hit the nail on the head! :) Both Matthieu & you are
right. I even confirmed the same by changing the content of mainline
while initializing repository. SHAs indeed became different for both
master and mainline. Now when i clone the repository on my local
machine, it correctly points to mainline. And special thanks for
pointing to the exact Git version where the flaw was fixed. :) I
checked the release notes too. :)

https://git.kernel.org/cgit/git/git.git/tree/Documentation/RelNotes/1.8.4.3.txt

Thank you guys! You rock!!!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-03-29  7:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-27 12:27 Change default branch name (server side) while cloning a repository Garbageyard
2015-03-27 14:27 ` Stefan Näwe
2015-03-27 16:47   ` Jeff King
2015-03-27 16:40 ` Matthieu Moy
  -- strict thread matches above, loose matches on Subject: below --
2015-03-29  7:33 Gaurav Chhabra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox