git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [Bug] Pathspec matching breaks the add command

From
Duy Nguyen <pclouds@gmail.com>
Date
Sep 17, 2018, 16:28 UTC
Message-ID
<CACsJy8CAyXAaax8dSPUUzTFvpKVG19FDives3JthL4hBxgf=6A@mail.gmail.com>
In-Reply-To
<20180917015259.GA26339@sebastianaudet.com>
On Mon, Sep 17, 2018 at 3:55 AM <smaudet@sebastianaudet.com> wrote:
Show 8 quoted lines
>
> The following:
>
> git add -u :\(glob,attr:-someAttr\):src/**
>
> Produces an error that, according to the source code, should never be visible to the user. This attribute/pathspec *should* be supported according to the documentation provided by git:
>
> fatal: BUG:builtin/add.c:498: unsupported magic 40

Brandon, b0db704652 (pathspec: allow querying for attributes - 2017-03-13) added attr support to match_pathspec(), but this add.c manipulates pathspec directly and (I think) does not support 'attr' attribute, which is correctly caught here.

I think we need to update the parse_pathspec() call in this file to declare 'attr' not supported. Then we get a friendlier error (or you make this code work too, that's even better). You may want to go through all parse_pathspec() call and make sure that if the pathspec is not consumed only by match_pathspec() then it should reject 'attr', otherwise we'll get this "BUG" again.

-- 
Duy
Previous: smaudet@sebastianaudet.comNext: Ævar Arnfjörð Bjarmason
Message 2 of 7 in “[Bug] Pathspec matching breaks the add command”
  1. smaudet@sebastianaudet.comSep 17, 2018
  2. Duy NguyenSep 17, 2018
  3. Brandon Williams's E-Mail bouncingÆvar Arnfjörð Bjarmason, Sep 17, 2018
  4. Stefan BellerSep 17, 2018
  5. add: do not accept pathspec magic 'attr'Nguyễn Thái Ngọc Duy, Sep 18, 2018
  6. Junio C HamanoSep 19, 2018
  7. Junio C HamanoSep 20, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.