Web lists-archives.com

Re: [PATCH] Deprecate support for .git/info/grafts




Hi Stefan,

On Fri, 13 Apr 2018, Stefan Beller wrote:

> On Fri, Apr 13, 2018 at 4:11 AM, Johannes Schindelin
> <johannes.schindelin@xxxxxx> wrote:
> > The grafts feature was a convenient way to "stich together" ancient
> > history to the fresh start of linux.git.
> 
> Did you mean: stitch?

Yes ;-)

> > Its implementation is, however, not up to Git's standards, as there are
> > too many ways where it can lead to surprising and unwelcome behavior.
> >
> > For example, when pushing from a repository with active grafts, it is
> > possible to miss commits that have been "grafted out", resulting in a
> > broken state on the other side.
> >
> > Also, the grafts feature is limited to "rewriting" commits' list of
> > parents, it cannot replace anything else.
> >
> > The much younger feature implemented as `git replace` set out to remedy
> > those limitations and dangerous bugs.
> >
> > Seeing as `git replace` is pretty mature by now, it is time to deprecate
> > support for the graft file, and to retire it eventually.
> 
> It seems that the maturity needed for this commit was reached in
> 4228e8bc98 (replace: add --graft option, 2014-07-19)

Right. I'll add that to the commit message.

> Reviewed-by: Stefan Beller <sbeller@xxxxxxxxxx>
> > Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
> > ---
> 
> >                 return -1;
> > +       if (advice_graft_file_deprecated)
> > +               advise(_("Support for <GIT_DIR>/info/grafts is deprecated\n"
> > +                        "and will be removed in a future Git version.\n"
> > +                        "\n"
> > +                        "Please use \"git replace --graft [...]\" instead.\n"
> > +                        "\n"
> > +                        "Turn this message off by running\n"
> > +                        "\"git config advice.graftFileDeprecated false\""));
> 
> So the user would have to run:
> 
>   for line in <GIT_DIR>/info/grafts:
>       git replace --graft $line
>       # The order in the grafts file is the same as the arguments,
>       # but we'd have to pass each as its own argument
>   rm <GIT_DIR>/info/grafts
> 
> I wonder if we want to offer a migration tool or just leave it
> at this hint.

There is contrib/convert-grafts-to-replace-refs.sh.

I wonder whether we have to care enough to implement a `git replace
--convert-graft-file`...

Ciao,
Dscho