Re: Cloning empty repositories, was Re: What is the idea for bare repositories?
From: Matthieu Moy <hidden>
Date: 2016-06-15 22:43:50
Brian Gernhardt [off-list ref] writes:
On Nov 13, 2007, at 5:50 AM, Matthieu Moy wrote:quoted
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/masterBut 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