Re: [PATCH] sequencer: honor GIT_REFLOG_ACTION
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Apr 7, 2020, 22:37 UTC
- Message-ID
- <nycvar.QRO.7.76.6.2004080037080.46@tvgsbejvaqbjf.bet>
- In-Reply-To
- <CABPp-BFXT1QkTLUFSAju2TwzVdSRjKSyLQYp2KaoW2+S2U8KJw@mail.gmail.com>
Hi Elijah,
On Tue, 7 Apr 2020, Elijah Newren wrote:
Show 44 quoted lines
> On Tue, Apr 7, 2020 at 7:50 AM Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> >
> > On Thu, 2 Apr 2020, Phillip Wood wrote:
> >
> > > On 02/04/2020 18:01, Elijah Newren wrote:
> > > >
> > > > On Thu, Apr 2, 2020 at 2:25 AM Phillip Wood <phillip.wood123@gmail.com>
> > > > wrote:
> > > > >
> > > > > On 01/04/2020 21:31, Elijah Newren via GitGitGadget wrote:
> > > > >
> > > > > > va_start(ap, fmt);
> > > > > > strbuf_reset(&buf);
> > > > > > - strbuf_addstr(&buf, action_name(opts));
> > > > > > + strbuf_addstr(&buf, reflog_action ? reflog_action :
> > > > > > action_name(opts));
> > > > > > if (sub_action)
> > > > > > strbuf_addf(&buf, " (%s)", sub_action);
> > > > > > if (fmt) {
> > > > > > @@ -3799,8 +3800,10 @@ static int pick_commits(struct repository *r,
> > > > > > struct replay_opts *opts)
> > > > > > {
> > > > > > int res = 0, reschedule = 0;
> > > > > > + char *prev_reflog_action;
> > > > > >
> > > > > > setenv(GIT_REFLOG_ACTION, action_name(opts), 0);
> > > > > > + prev_reflog_action = xstrdup(getenv(GIT_REFLOG_ACTION));
> > > > >
> > > > > I'm confused as to why saving the environment variable immediately after
> > > > > setting it works but the test shows it does - why doesn't this clobber
> > > > > the value of GIT_REFLOG_ACTION set by the user?
> > > >
> > > > The third parameter, 0, means only set the environment variable if
> > > > it's not already set.
> > >
> > > Ah thanks, I thought I must be missing something fairly obvious but couldn't
> > > see what it was
> >
> > FWIW I was also about to comment on that. Maybe that warrants even a code
> > comment above the `prev_reflog_action`?
>
> Yeah, if it tripped you both up, I'll add such a comment to the code
> to help explain it.Thank you! Dscho