> On Tue, Jan 26 2021, Jonathan Tan wrote: > > [For some reason the patches didn't reach my mailbox, but I see them in > the list archive, so I'm replying to the cover-letter] > > > Documentation/config.txt | 2 + > > Documentation/config/init.txt | 2 +- > > Good, now we have init.defaultBranch docs, but they say: > > init.defaultBranch:: > Allows overriding the default branch name e.g. when initializing > - a new repository or when cloning an empty repository. > + a new repository. > > So this still only applies to file:// and other "protocol" clones, but > not "git clone /some/path"? Ah...that's true. > Re my reply to v1, do we consider that a bug, feature, something just > left unimplemented? > > I really don't care much, but this really needs a corresponding > documentation update. I.e. something like: > > init.defaultBranch:: > Allows overriding the default branch name e.g. when initializing a > new repository or when cloning an empty repository. > > When cloning a repository over protocol v2 (i.e. ssh://, https://, > file://, but not a /some/path), and if that repository has > init.defaultBranch configured, the server will advertise its > preferred default branch name, and we'll take its configuration over > ours. Thanks - I'll use some of your wording, but I think it's best to leave open the possibility that cloning using protocol v0 or the disk clone (/some/path) copies over the current HEAD as well. > Which, just in terms of implementation makes me think it would make more > sense if the server just had: > > uploadPack.sendConfig = "init.defaultBranch=xyz" > > The client: > > receivePack.acceptConfig = "init.defaultBranch" > > And in terms of things on the wire we'd say: > > "set-config init.defaultBranch=main" > > You could have many such lines, but we'd just harcode only accepting > "init.defaultBranch" by default for now. > > I.e. we set "init.defaultBranch" on the server, and the client ends up > interpreting things as if though "init.defaultBranch" was set to exactly > that value. So why not just ... send a line saying "you should set your > init.defaultBranch config to this". > > Makes it future-extensible pretty much for free, and I think also much > easier to explain to users. I.e. instead of init.defaultBranch somehow > being magical when talking with a remote server we can talk about a > remote server being one source of config per git-config's documented > config order, for a very narrow whitelist of config keys. > > Or (not clear to me, should have waited with my other E-Mail) are we > ever expecting to send more than one of: > > "unborn <refname> symref-target:<target>" > > Or is the reason closer to us being able to shoehorn this into the > existing ls-refs response, as opposed to some general "here's config for > you" response we don't have? It's not the same - from what I understand, what you're suggesting is setting a config in the repo that has just been cloned, but this patch set does not set any such config. Also, it may be strange for the server to be able to change the config of a currently running command - I would expect such a thing to only take effect on future runs of Git on that repo.