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

Re: [PATCH] doc: ls-tree paths do not support wildcards

From
Jeff King <peff@peff.net>
Date
May 28, 2020, 23:04 UTC
Message-ID
<20200528230454.GA1267915@coredump.intra.peff.net>
In-Reply-To
<xmqqy2pb1z0x.fsf@gitster.c.googlers.com>
On Thu, May 28, 2020 at 03:21:34PM -0700, Junio C Hamano wrote:
Show 20 quoted lines
> >   1. Deprecate the current behavior in the documentation and release
> >      notes, encouraging people who want literal matching to use
> >      --literal-pathspecs or the ":(literal)" magic. AFAICT we've
> >      supported these since at least 2013 for this command, so it should
> >      be safe to use unconditionally.
> >
> >   2. Add a new option, "--use-pathspecs" or similar, that switches the
> >      matching code to use match_pathspec(). That lets people use the new
> >      feature immediately if they want to.
> >
> >   3. When --use-pathspecs is not in use, warn to stderr about any
> >      wildcard characters in the input. That reinforces the deprecation
> >      notice in (1) and is likely to get more people's attention.
> 
> Hmph, if we are serious about deprecation and migration, I would
> image that in stage #1, we should do this check already.  When
> "--literal-pathspecs" is NOT in use, if a pathspec would change its
> meaning if not taken literally (e.g. has glob letters, begins with
> :-magic introducer, etc.), we warn and do so from the very beginning
> of the migration process.
Yeah, sorry, I meant these three steps to all happen at once.

Technically we don't need step (2) in there for the deprecation, but I think it lets people adjust to the new world order as their solution to avoid the warning (though I guess literal-pathspecs would also prevent the warning; we wouldn't be looking for "*" in the input so much as checking whether the parsed pathspec contains a wildcard).

Show 6 quoted lines
> >   4. After several releases, flip the default to --use-pathspecs,
> >      leaving --no-use-pathspecs as an escape hatch for people who still
> >      haven't switched their scripts.
> 
> Wouldn't --literal-pathspecs be the accepted escape hatch that will
> always be accepted, even after --use-pathspecs becomes a no-op?

Hmm, I guess so. That wouldn't restore the behavior as it is _now_, but the current behavior is sort of pointless. It treats pathspec magic as special, but not globs. I doubt anybody actually wants that; they'd either want pathspecs or literal paths.

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 7 in “doc: ls-tree paths do not support wildcards”
  1. doc: ls-tree paths do not support wildcardsSteven Willis via GitGitGadget, May 28, 2020
  2. Jeff KingMay 28, 2020
  3. Junio C HamanoMay 28, 2020
  4. Jeff KingMay 28, 2020
  5. Junio C HamanoMay 28, 2020
  6. Junio C HamanoMay 28, 2020
  7. Jeff KingMay 28, 2020

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.