Re: Cloning empty repositories, was Re: What is the idea for bare repositories?
- From
Matthieu Moy <matthieu.moy@imag.fr>
- Date
- Nov 13, 2007, 21:48 UTC
- Message-ID
- <vpqhcjp6clm.fsf@bauges.imag.fr>
- In-Reply-To
- <CBAEC42B-9F50-4723-9847-640D9832532E@silverinsanity.com>
Brian Gernhardt <benji@silverinsanity.com> writes:
Show 15 quoted lines
> On Nov 13, 2007, at 5:50 AM, Matthieu Moy wrote: > >> While clone normally does a bit more: >> >> [remote "origin"] >> url = /tmp/git1/.git >> fetch = +refs/heads/*:refs/remotes/origin/* >> [branch "master"] >> remote = origin >> merge = refs/heads/master > > But how is clone expected to do that when the origin is an empty > repo? There is no branch for it to track, and automagically setting > it to master is bogus because then it's tracking something that > doesn't exist.
An implementation of that would probably need to special-case the empty repository. But an empty repository is already a special case. HEAD already points to master, and master is already hardcoded here:
$ cat .git/HEAD ref: refs/heads/master
So, it's possible for HEAD to point to a branch which doesn't exist yet, it's possible to commit to a branch which doesn't exist yet. It would make sense to extend that to allow a remote to point to a branch which doesn't exist either.
But don't get me wrong: I probably won't implement that myself, so I can't _ask_ people to do it for me. I would just appreciate if people stopped calling me (and other users interested in a sane empty clone behavior) idiot because I think it would make sense to do it.
-- Matthieu