Re: [PATCH] sequencer: honor GIT_REFLOG_ACTION
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Apr 7, 2020, 14:50 UTC
- Message-ID
- <nycvar.QRO.7.76.6.2004071649190.46@tvgsbejvaqbjf.bet>
- In-Reply-To
- <09397e37-a22b-5159-b760-bae238ae3ed6@gmail.com>
Hi,
On Thu, 2 Apr 2020, Phillip Wood wrote:
Show 33 quoted lines
> 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 wasFWIW I was also about to comment on that. Maybe that warrants even a code comment above the `prev_reflog_action`?
Ciao, Dscho