Re: Propose promoting 'contrib/rerere-train.sh' to command
Hi,
On Sun, 22 Dec 2019, Tom Miller wrote:
Show 41 quoted lines
> On Sun Dec 22, 2019 at 2:58 AM, Jeff King wrote:
> > On Sat, Dec 21, 2019 at 03:52:53PM -0800, Junio C Hamano wrote:
> >
> >
> > > Jeff King <peff@peff.net> writes:
> > >
> > > > The situations where I need rerere-train don't come up often, but when
> > > > they do, it has always worked easily and without hiccups for me. So
> > > > perhaps there are lurking gotchas that Junio might know about, but AFAIK
> > > > the quality is high enough for it to be part of normal Git.
> > >
> > > I actually suspect that rewriting has a high chance of initially
> > > degrading the quality, so we should take a two step approach if we
> > > really want it as part of the core distribution. As to the UI, I
> > > think "git rerere train a..b" would be a good one, but if the
> > > scripted version is of high quality (I haven't looked at it for a
> > > long time---even though I used it for a couple of times a year in
> > > recent years), perhaps we can add it as "git-rerere--train"
> > > subcommand that is spawned from "builtin/rerere.c" for the first
> > > cut?
> >
> >
> > Yeah, I'd be pretty happy with that, too.
> >
> >
> > I just suspect its ultimate fate is conversion to C, given the general
> > trend. And converting it to C that just calls out to other git commands
> > via run_command would presumably behave just like the original, leaving
> > the more challenging and error-prone conversion for later. Hopefully any
> > upgrade to "real Git command" would include some tests, though. :)
> >
> >
> > -Peff
>
> Thanks for the feedback everyone! This is roughly the feedback I
> expected. I think moving the shell version first will give more time to
> focus on getting a strong test harness in place and a some decent
> documentation. I happy with doing this in a multi phase approach as it
> introduces less risk. When I get to the point of writing it in C I will
> try to do the work internally by looking at commits as Jeff has
> suggested, and fall back to run commands if I have to.
As the person who traditionally ends up being stuck with such conversions, I would like to point out that the rerere-train script has not changed _in years_ and that there is little point in trying to let it "cook" some more in the scripted form, _in particular_ because this would prevent the command from having access to the more powerful C API for future improvements.
One very obvious enhancement would be to perform the training in memory, without even clobbering the worktree. That's simply not a thing that a shell script can perform.
Food for thought, Dscho