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

Re: ls-tree and wildcards

From
Junio C Hamano <gitster@pobox.com>
Date
May 15, 2012, 15:35 UTC
Message-ID
<7vd365foec.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CACsJy8AdoOcUxq+pmhAPxiPAiQc60aCLf7Jt31YFW4+6OHZEEg@mail.gmail.com>
Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:
Show 10 quoted lines
> On Mon, May 14, 2012 at 11:43 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Later Nguyen and others started working on unifying the two separate
>> "pathspec" semantics and we are probably halfway there.  Many of the
>> commands from "diff/log" family now can take wildcard (there may be new
>> bugs in the codepaths, though), but "ls-tree" has not been converted.
>
> Do we break backward compatibility by teaching ls-tree new pathspec
> semantics? I guess directories with wildcards in the name are rare,
> the chance of someone doing "ls-tree a*" is low. But I may miss
> something.

If you change ls-tree to use its paths arguments as pathspec, you will break backward compatibility.

But nobody stops us from _adding_ an option to ls-tree to tell it to switch between the two, i.e.

	git ls-tree HEAD -- '*.c'
	git ls-tree --pathspec HEAD -- '*.c'

The former will use the traditional "leading path match only" while the latter uses the (to-be) unified "pathspec" semantics.

Internally, the implementation could very well do something like this after parsing the options:

	if (!opt_pathspec)
        	prefix ":(noglob)" to all paths args
and use the updated code with magic pathspec support to handle both cases.
Previous: Nguyen Thai Ngoc Duy
Message 6 of 6 in “ls-tree and wildcards”
  1. Ryan McCueMay 12, 2012
  2. Nguyen Thai Ngoc DuyMay 12, 2012
  3. Ryan McCueMay 12, 2012
  4. Junio C HamanoMay 14, 2012
  5. Nguyen Thai Ngoc DuyMay 15, 2012
  6. Junio C HamanoMay 15, 2012

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.