Re: [PATCH 10/17] pathspec: simpler logic to prefix original pathspec elements

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

 



On 12/06, Stefan Beller wrote:
> On Tue, Dec 6, 2016 at 1:51 PM, Brandon Williams <bmwill@xxxxxxxxxx> wrote:
> 
> >                 struct strbuf sb = STRBUF_INIT;
> > -               if (prefixlen && !literal_global) {
> > -                       /* Preserve the actual prefix length of each pattern */
> > -                       if (short_magic)
> > -                               prefix_short_magic(&sb, prefixlen, short_magic);
> > -                       else if (long_magic_end) {
> > -                               strbuf_add(&sb, elt, long_magic_end - elt);
> > -                               strbuf_addf(&sb, ",prefix:%d)", prefixlen);
> > -                       } else
> > -                               strbuf_addf(&sb, ":(prefix:%d)", prefixlen);
> 
> This fixes the issue with add -p . mentioned somewhere else on the mailing list.
>
> > -               }
> > +
> > +               /* Preserve the actual prefix length of each pattern */
> > +               prefix_magic(&sb, prefixlen, element_magic);
> > +
> 
> Did you find a reason why we passed magic literally, i.e. short magic
> was passed as short magic and long magic as long magic before?
> 
> I cannot think of any reason why that would have been the case,
> but I assume there had to be a reason for that.

nope, perhaps it was because we technically already have the long magic
string and the short magic needs to be converted to long magic (as you
can't mix short and long magic).

> Another note: This collides with the attr system refactoring, which I
> postpone redoing until the submodule checkout is done, so maybe
> you want to pickup this patch:
> https://public-inbox.org/git/20161110203428.30512-31-sbeller@xxxxxxxxxx/
> which only relies on one patch prior
> https://public-inbox.org/git/20161110203428.30512-30-sbeller@xxxxxxxxxx/

After looking at those patches I think I do something extremely similar
in a future patch in this series, the parse_long_magic patch.

-- 
Brandon Williams



[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]