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

Re: [BUG] "git --literal-pathspecs blame" broken in master

From
Jeff King <peff@peff.net>
Date
Oct 25, 2013, 04:18 UTC
Message-ID
<20131025041837.GA17266@sigill.intra.peff.net>
In-Reply-To
<CACsJy8Aw9KyeWqgC5KQmqPrzD7J4Gga1ibDTvfNQFaVN303U9g@mail.gmail.com>
On Fri, Oct 25, 2013 at 11:16:08AM +0700, Nguyen Thai Ngoc Duy wrote:
Show 16 quoted lines
> > All of the GUARD_PATHSPEC calls indicate that everybody understands
> > PATHSPEC_LITERAL. It is not technically true that git-blame understands
> > the literal pathspec magic:
> >
> >   $ git blame -- ':(literal)revision.c'
> >   fatal: no such path ':(literal)revision.c' in HEAD
> >
> > but that is a separate bug (that blame considers the argument as a path
> > first before feeding it to the pathspec machinery). The patch above does
> > not fix that, but AFAICT it does not make anything worse.
> 
> I did consider this change but dropped it because there are more
> parse_pathspec() calls with PATHSPEC_ALL_MAGIC as mask. Thanks for
> bringing up ":(literal)".  I guess we need to change prefix_pathspec()
> to set PATHSPEC_LITERAL only when :(literal) is present, not when
> --literal-pathspecs is used.

I considered suggesting that, too, but it means that everywhere that checks for PATHSPEC_LITERAL must _also_ check for literal_global (e.g., if they were deciding to feed the result to fnmatch). Whereas if we catch it at the parse_pathspec layer, then the consumers of the pathspec just need to check the one flag.

I dunno. I haven't kept up very well with your work in this area, so you probably have a better sense than I do of what would be the most elegant.

-Peff
Previous: Duy NguyenNext: Duy Nguyen
Message 4 of 8 in “[BUG] "git --literal-pathspecs blame" broken in master”
  1. Jeff KingOct 25, 2013
  2. Jeff KingOct 25, 2013
  3. Duy NguyenOct 25, 2013
  4. Jeff KingOct 25, 2013
  5. Duy NguyenOct 25, 2013
  6. pathspec: stop --*-pathspecs impact on internal parse_pathspec() usesNguyễn Thái Ngọc Duy, Oct 26, 2013
  7. Jeff KingOct 26, 2013
  8. pathspec: stop --*-pathspecs impact on internal parse_pathspec() usesNguyễn Thái Ngọc Duy, Oct 26, 2013

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.