Re: [PATCH 0/3] Support setting SymrefsOnly=true from scripts
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Nov 16, 2005, 00:49 UTC
- Message-ID
- <Pine.LNX.4.63.0511160127130.4334@wbgn013.biozentrum.uni-wuerzburg.de>
- In-Reply-To
- <7vfypxh5mn.fsf@assigned-by-dhcp.cox.net>
Hi,
On Tue, 15 Nov 2005, Junio C Hamano wrote:
Show 9 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes: > > > - set SymrefsOnly=true right from the start with > > git-init-db --dont-use-symrefs > > I am almost tempted to say that we should be doing --template= > option to git-init-db for something like this, and make the > template instantiation first thing before even reading the > config file.
Well, problem is that if you use templates to install a .git/config, the code in init-db which checks for safe filemode no longer gets called. And we don't know yet what else we might want to write into the config from init-db, or from anywhere else for that matter.
Furthermore: if you have a nice template which says that SymrefsOnly=true, init-db will still create HEAD as a symlink! (Note that my patch sets the *global* only_use_symrefs from the command line option, not a local variable!)
So, if you want a repository to explicitely force symrefs, you have to have special handling in init-db. And for consistency, you should modify/write the config file to include "SymrefsOnly=true" right away.
Alternatively, or in addition to my patch, you could do a git_config() just after copy_templates() (you allude to this, but note that init-db does not read the config at any stage yet).
However! This only works if you are sure that the templates you need are installed. I *never* install git, but *always* have my private working directory in the PATH. So, I never have templates installed. Neither do I plan to.
> The rest might be useful to better support end-users, but I am > not sure. Is it that much hassle to them to edit an .ini file?
Obviously, I'd prefer to have at least the patch adding git_config_set() applied. This is core plumbing. It actually checks if the name is valid, and it automatically escapes the value when needed. Before doing anything, it checks that the config file is valid. It does locking. It creates a simple config if none was there yet. And it's small.
As for git-config-set, I guess it would be rather handy for Porcelains (and t/blabla-config.sh), but I could be convinced otherwise.
Ciao, Dscho