Re: [PATCH] sequencer: honor GIT_REFLOG_ACTION

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

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@xxxxxxxxx>
> > 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`?

Ciao,
Dscho




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux