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

Re: Expected behaviour for pathspecs matching attributes in subdirectories

From
Matthew Hughes <matthewhughes934@gmail.com>
Date
Jul 8, 2023, 12:42 UTC
Message-ID
<20230708124253.6g2sl2diipqfma7g@archP14s>
In-Reply-To
<xmqq1qhjbpoz.fsf@gitster.g>
On Fri, Jul 07, 2023 at 10:23:56AM -0700, Junio C Hamano wrote:
> I think in this case the common prefix optimization in "ls-files.c"
> is broken.  If we disable it like the attached illustration patch,
> we will see that pathspecs that end with "sub" or "sub/" behave the
> same way, which is what I think people would expect.

Thanks, this also revealed a temporary workaround for me, just add a pathspec that ensures there's no common prefix but also matches nothing:

    $ git ls-files -- ':(attr:labelA)sub/sub/' 'not/a/real/path'
    sub/sub/fileA

I might have a look into that optimization and see what changes might be made, but given I am unfamiliar with the code-base this might not be the most productive search.

Previous: Eric Sunshine
Message 9 of 9 in “Expected behaviour for pathspecs matching attributes in subdirectories”
  1. Matthew HughesJul 6, 2023
  2. Junio C HamanoJul 6, 2023
  3. Matthew HughesJul 6, 2023
  4. Matthew HughesJul 6, 2023
  5. Junio C HamanoJul 6, 2023
  6. Matthew HughesJul 7, 2023
  7. Junio C HamanoJul 7, 2023
  8. Eric SunshineJul 7, 2023
  9. Matthew HughesJul 8, 2023

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.