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

[PATCH] add: do not accept pathspec magic 'attr'

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Sep 18, 2018, 17:31 UTC
Message-ID
<20180918173159.30300-1-pclouds@gmail.com>
In-Reply-To
<20180917015259.GA26339@sebastianaudet.com>

Commit b0db704652 (pathspec: allow querying for attributes - 2017-03-13) adds new pathspec magic 'attr' but only with match_pathspec(). "git add" has some pathspec related code that still does not know about 'attr' and will bail out:

    $ git add ':(attr:foo)'
    fatal: BUG:dir.c:1584: unsupported magic 40

A better solution would be making this code support 'attr'. But I don't know how much work is needed (I'm not familiar with this new magic). For now, let's simply reject this magic with a friendlier message:

    $ git add ':(attr:foo)'
    fatal: :(attr:foo): pathspec magic not supported by this command: 'attr'
Reported-by: smaudet@sebastianaudet.com
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Since Brandon is currently unreachable, let's do this for now. I
 might eventually find time to go over pathspec code and see if I can
 add 'attr' support to the rest of the commands, but no promise.
 builtin/add.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/add.c b/builtin/add.c
index 9916498a29..0b64bcdebe 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -454,7 +454,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 	 * Check the "pathspec '%s' did not match any files" block
 	 * below before enabling new magic.
 	 */
-	parse_pathspec(&pathspec, 0,
+	parse_pathspec(&pathspec, PATHSPEC_ATTR,
 		       PATHSPEC_PREFER_FULL |
 		       PATHSPEC_SYMLINK_LEADING_PATH,
 		       prefix, argv);
-- 
2.19.0.rc0.337.ge906d732e7
Previous: Stefan BellerNext: Junio C Hamano
Message 5 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.