git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] custom strategies in builtin-merge
@ 2008-07-25 11:33 Miklos Vajna
  2008-07-25 11:50 ` Sverre Rabbelier
  0 siblings, 1 reply; 6+ messages in thread
From: Miklos Vajna @ 2008-07-25 11:33 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin

[-- Attachment #1: Type: text/plain, Size: 760 bytes --]

Hi,

We talked with Dscho about how would it be possible to allow custom
strategies in builtin-merge and I have a question here.

The problem is that currently merge strategies are always named
git-merge-foo, but not all git-merge-foo is a merge strategy.

So we talked about two solutions here:

1) Maintain a list of commands that has a git-merge- prefix, but not a
strategy. This list would currently contain "base, file, index,
one-file and tree".

2) Require custom strategies to have a different naming scheme, like
if "foo" is a custom strategy, then it would have to be named
git-merge-custom-foo, _not_ git-merge-foo.

Both are doable (I prefer 1) a bit), but I thought it's better to ask
first before I implement any of them.

So, comments?

Thanks.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [RFC] custom strategies in builtin-merge
  2008-07-25 11:33 [RFC] custom strategies in builtin-merge Miklos Vajna
@ 2008-07-25 11:50 ` Sverre Rabbelier
  2008-07-26  0:33   ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Sverre Rabbelier @ 2008-07-25 11:50 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: git, Johannes Schindelin

On Fri, Jul 25, 2008 at 13:33, Miklos Vajna <vmiklos@frugalware.org> wrote:
> 1) Maintain a list of commands that has a git-merge- prefix, but not a
> strategy. This list would currently contain "base, file, index,
> one-file and tree".

Sounds a bit error prone, and could lead to unexpected results if/when
someone creates a new command ('git merge status' anyone?) which is
then suddenly treated as a merge strategy.

> 2) Require custom strategies to have a different naming scheme, like
> if "foo" is a custom strategy, then it would have to be named
> git-merge-custom-foo, _not_ git-merge-foo.

I think this is cleaner, what would be even nicer is to change the
current names too, so name them all "git-merge-stragegy-foo".

-- 
Cheers,

Sverre Rabbelier

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

* Re: [RFC] custom strategies in builtin-merge
  2008-07-25 11:50 ` Sverre Rabbelier
@ 2008-07-26  0:33   ` Junio C Hamano
  2008-07-26  0:51     ` Johannes Schindelin
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2008-07-26  0:33 UTC (permalink / raw)
  To: sverre; +Cc: Miklos Vajna, git, Johannes Schindelin

"Sverre Rabbelier" <alturin@gmail.com> writes:

> On Fri, Jul 25, 2008 at 13:33, Miklos Vajna <vmiklos@frugalware.org> wrote:
>> 1) Maintain a list of commands that has a git-merge- prefix, but not a
>> strategy. This list would currently contain "base, file, index,
>> one-file and tree".
>
> Sounds a bit error prone, and could lead to unexpected results if/when
> someone creates a new command ('git merge status' anyone?) which is
> then suddenly treated as a merge strategy.
>
>> 2) Require custom strategies to have a different naming scheme, like
>> if "foo" is a custom strategy, then it would have to be named
>> git-merge-custom-foo, _not_ git-merge-foo.
>
> I think this is cleaner, what would be even nicer is to change the
> current names too, so name them all "git-merge-stragegy-foo".

I think you could retroactively impose "git-merge-strategy-" prefix rule
and grandfather the existing ones by maintaining a list of them that by
definition will not grow anymore.

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

* Re: [RFC] custom strategies in builtin-merge
  2008-07-26  0:33   ` Junio C Hamano
@ 2008-07-26  0:51     ` Johannes Schindelin
  2008-07-26  1:12       ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Schindelin @ 2008-07-26  0:51 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: sverre, Miklos Vajna, git

Hi,

On Fri, 25 Jul 2008, Junio C Hamano wrote:

> "Sverre Rabbelier" <alturin@gmail.com> writes:
> 
> > On Fri, Jul 25, 2008 at 13:33, Miklos Vajna <vmiklos@frugalware.org> wrote:
> >> 1) Maintain a list of commands that has a git-merge- prefix, but not a
> >> strategy. This list would currently contain "base, file, index,
> >> one-file and tree".
> >
> > Sounds a bit error prone, and could lead to unexpected results if/when
> > someone creates a new command ('git merge status' anyone?) which is
> > then suddenly treated as a merge strategy.
> >
> >> 2) Require custom strategies to have a different naming scheme, like
> >> if "foo" is a custom strategy, then it would have to be named
> >> git-merge-custom-foo, _not_ git-merge-foo.
> >
> > I think this is cleaner, what would be even nicer is to change the
> > current names too, so name them all "git-merge-stragegy-foo".
> 
> I think you could retroactively impose "git-merge-strategy-" prefix rule 
> and grandfather the existing ones by maintaining a list of them that by 
> definition will not grow anymore.

... especially since I hope that we have them builtin soon, and not only 
that, but have builtin-merge call them as C functions, not with fork() and 
exec().

Ciao,
Dscho

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

* Re: [RFC] custom strategies in builtin-merge
  2008-07-26  0:51     ` Johannes Schindelin
@ 2008-07-26  1:12       ` Junio C Hamano
  2008-07-26  2:37         ` Johannes Schindelin
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2008-07-26  1:12 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: sverre, Miklos Vajna, git

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

> ... especially since I hope that we have them builtin soon, and not only 
> that, but have builtin-merge call them as C functions, not with fork() and 
> exec().

Because builtin-merge.c does not directly use fork/exec but uses
run_command() interface, non POSIX platforms can spawn subprocesses just
fine, can't they?

I do not think at this point it is of any high priority to call strategies
internally, avoiding fork/exec.  We may apply hundreds of patches per
minute, but would fork/exec overhead matter for merges?

Especially because some strategies (recursive and perhaps the rumored
"blame" even more so) are quite data intensive operations, libifying them
is not worth it, compared to the nice isolation between processes we get
from running them as a separate program.  We get the necessary clean-up
after strategy did its thing for almost free (well, "at the cost of
fork/exec").

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

* Re: [RFC] custom strategies in builtin-merge
  2008-07-26  1:12       ` Junio C Hamano
@ 2008-07-26  2:37         ` Johannes Schindelin
  0 siblings, 0 replies; 6+ messages in thread
From: Johannes Schindelin @ 2008-07-26  2:37 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: sverre, Miklos Vajna, git

Hi,

On Fri, 25 Jul 2008, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > ... especially since I hope that we have them builtin soon, and not 
> > only that, but have builtin-merge call them as C functions, not with 
> > fork() and exec().
> 
> Because builtin-merge.c does not directly use fork/exec but uses 
> run_command() interface, non POSIX platforms can spawn subprocesses just 
> fine, can't they?

Yes, they can.  Slowly, but they do.

But why should they?  Efficient merging is such a prominent feature of 
Git; I do not agree to let it remain a second-class feature.

Ciao,
Dscho

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

end of thread, other threads:[~2008-07-26  2:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-25 11:33 [RFC] custom strategies in builtin-merge Miklos Vajna
2008-07-25 11:50 ` Sverre Rabbelier
2008-07-26  0:33   ` Junio C Hamano
2008-07-26  0:51     ` Johannes Schindelin
2008-07-26  1:12       ` Junio C Hamano
2008-07-26  2:37         ` Johannes Schindelin

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).