git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Support setting SymrefsOnly=true from scripts
@ 2005-11-15 21:36 Johannes Schindelin
  2005-11-15 23:07 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Schindelin @ 2005-11-15 21:36 UTC (permalink / raw)
  To: git, junkio

Hi,

this series of patches does three things:

	- support for setting config variables
	- ditto, but from scripts
	- set SymrefsOnly=true right from the start with

		git-init-db --dont-use-symrefs

Ciao,
Dscho

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

* Re: [PATCH 0/3] Support setting SymrefsOnly=true from scripts
  2005-11-15 21:36 [PATCH 0/3] Support setting SymrefsOnly=true from scripts Johannes Schindelin
@ 2005-11-15 23:07 ` Junio C Hamano
  2005-11-16  0:49   ` Johannes Schindelin
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2005-11-15 23:07 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

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.

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?

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

* Re: [PATCH 0/3] Support setting SymrefsOnly=true from scripts
  2005-11-15 23:07 ` Junio C Hamano
@ 2005-11-16  0:49   ` Johannes Schindelin
  2005-11-16  1:09     ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Schindelin @ 2005-11-16  0:49 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi,

On Tue, 15 Nov 2005, Junio C Hamano wrote:

> 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

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

* Re: [PATCH 0/3] Support setting SymrefsOnly=true from scripts
  2005-11-16  0:49   ` Johannes Schindelin
@ 2005-11-16  1:09     ` Junio C Hamano
  2005-11-17 12:09       ` Petr Baudis
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2005-11-16  1:09 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> On Tue, 15 Nov 2005, Junio C Hamano wrote:
>
>> 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!

Funny.  These two are what I meant by "make the template
instantiation first thing".  So instead of the hardcoded
only_symbolic_ref assignment and filemode check code, can't we
do something like this?

 - copy the template; if the commandline specifies where the
   templates are, take them from there otherwise use the
   built-in location.

 - read from config; note if you actually read any (may not have
   config in your template suite, or you might not have
   templates at all).

 - do filemode check, and maybe git_config_set() there and write
   the result back as the new config for that repository.

 - create the rest, including the HEAD ref.

The user could even have more than one template set (one for
VFAT and another for non VFAT).  Once we go that route, we may
not even need the special filemode check code in init-db.  No?

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

* Re: [PATCH 0/3] Support setting SymrefsOnly=true from scripts
  2005-11-16  1:09     ` Junio C Hamano
@ 2005-11-17 12:09       ` Petr Baudis
  2005-11-17 19:29         ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Petr Baudis @ 2005-11-17 12:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Schindelin, git

Dear diary, on Wed, Nov 16, 2005 at 02:09:05AM CET, I got a letter
where Junio C Hamano <junkio@cox.net> said that...
>  - copy the template; if the commandline specifies where the
>    templates are, take them from there otherwise use the
>    built-in location.

The disadvantage is that I will have to maintain my own template for
Cogito, which is silly - I would much rather just use GIT's default
templates and only add the symrefonly option on behalf of Cogito.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
VI has two modes: the one in which it beeps and the one in which
it doesn't.

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

* Re: [PATCH 0/3] Support setting SymrefsOnly=true from scripts
  2005-11-17 12:09       ` Petr Baudis
@ 2005-11-17 19:29         ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2005-11-17 19:29 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Johannes Schindelin, git

Petr Baudis <pasky@suse.cz> writes:

> The disadvantage is that I will have to maintain my own template for
> Cogito, which is silly - I would much rather just use GIT's default
> templates and only add the symrefonly option on behalf of Cogito.

That's very true.  However I suspect Cogito users are expected
to run cg-admin-init not git-init-db, so admin-init can do
whatever postprocessing necessary after calling init-db?  That
way would let you do more than what template would, I presume.

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

end of thread, other threads:[~2005-11-17 19:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-15 21:36 [PATCH 0/3] Support setting SymrefsOnly=true from scripts Johannes Schindelin
2005-11-15 23:07 ` Junio C Hamano
2005-11-16  0:49   ` Johannes Schindelin
2005-11-16  1:09     ` Junio C Hamano
2005-11-17 12:09       ` Petr Baudis
2005-11-17 19:29         ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).