Re: [PATCH 1/2] [GSOC] cherry-pick: fix bug when used with GIT_CHERRY_PICK_HELP
- From
ZheNing Hu <adlternative@gmail.com>
- Date
- Aug 2, 2021, 13:34 UTC
- Message-ID
- <CAOLTT8S=v41p_uZQ4u0LBnHkRp3pMpVK0Pt5mykzbfX9ReTC7g@mail.gmail.com>
- In-Reply-To
- <273d1864-422e-f31f-13ef-20cfe4871947@gmail.com>
Phillip Wood <phillip.wood123@gmail.com> 于2021年8月1日周日 下午6:10写道:
Show 22 quoted lines
>
> > diff --git a/builtin/rebase.c b/builtin/rebase.c
> > index 12f093121d9..5983f37d531 100644
> > --- a/builtin/rebase.c
> > +++ b/builtin/rebase.c
> > @@ -84,6 +84,7 @@ struct rebase_options {
> > REBASE_FORCE = 1<<3,
> > REBASE_INTERACTIVE_EXPLICIT = 1<<4,
> > } flags;
> > + int delete_cherry_pick_head;
> > struct strvec git_am_opts;
> > const char *action;
> > int signoff;
> > @@ -152,6 +153,7 @@ static struct replay_opts get_replay_opts(const struct rebase_options *opts)
> > oidcpy(&replay.squash_onto, opts->squash_onto);
> > replay.have_squash_onto = 1;
> > }
> > + replay.delete_cherry_pick_head = opts->delete_cherry_pick_head;
>
> I think we could just have
> replay.delete_cherry_pick_head = 1;
> and not add a new member to rebase_options as we always want this setMaybe you are right.
Show 25 quoted lines
> > -static void print_advice(struct repository *r, int show_hint,
> > - struct replay_opts *opts)
> > +static void print_advice(struct replay_opts *opts, int show_hint)
> > {
> > char *msg = getenv("GIT_CHERRY_PICK_HELP");
> >
> > if (msg) {
> > - fprintf(stderr, "%s\n", msg);
> > - /*
> > - * A conflict has occurred but the porcelain
> > - * (typically rebase --interactive) wants to take care
> > - * of the commit itself so remove CHERRY_PICK_HEAD
> > - */
> > - refs_delete_ref(get_main_ref_store(r), "", "CHERRY_PICK_HEAD",
> > - NULL, 0);
> > - return;
> > - }
> > -
> > - if (show_hint) {
> > + advise("%s\n", msg);
>
> This is a change in behavior as the advice will now be prefixed with
> "hint: ". I think that is probably an improvement so long as it does not
> make the lines too long when the advice is printed.
>Yeah, maybe I should mention this in commit messages.
Show 5 quoted lines
> > I think it would be useful to add a test for the new cherry-pick option > that is added in this patch. Overall this patch is looking pretty good > it just needs a few small changes, thanks for working on it. >
Make sence.
> Best Wishes > > Phillip
Thanks. -- ZheNing Hu