All of lore.kernel.org
 help / color / mirror / Atom feed
* Expected behaviour for pathspecs matching attributes in subdirectories
@ 2023-07-06 10:33 Matthew Hughes
  2023-07-06 17:35 ` Junio C Hamano
  0 siblings, 1 reply; 9+ messages in thread
From: Matthew Hughes @ 2023-07-06 10:33 UTC (permalink / raw)
  To: git

Hi,

I'm working with pathspecs matching on attributes, here's a basic repo setup:

    $ git init .
    $ mkdir -p sub/sub
    $ touch fileA sub/fileA sub/sub/fileA
    $ echo 'fileA labelA' > sub/.gitattributes
    $ git add .
    $ git commit -m 'Build the repo'

What I want to do: list all files under 'sub/sub' that have 'labelA' as an
attribute.

Working from the top level I get the output I would expect:

    $ git ls-files -- ':(attr:labelA)'
    sub/fileA
    sub/sub/fileA
    $ git ls-files -- ':(attr:labelA)sub'
    sub/fileA
    sub/sub/fileA

But as soon as a directory is included in the pathspec's path no files are
returned:

    $ git ls-files -- ':(attr:labelA)sub/'
    $ git ls-files -- ':(attr:labelA)sub/sub'

Without the attribtue magic I can use a directory to list files there:

    $ git ls-files -- sub/sub
    sub/sub/fileA

Is this the expected behaviour? I looked in t/t6135-pathspec-with-attrs.sh and
didn't see a test case covering something similar. If this is expected, is
there another way to achieve what I'm looking for?

Thanks for your time,
Matt

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-07-08 12:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-06 10:33 Expected behaviour for pathspecs matching attributes in subdirectories Matthew Hughes
2023-07-06 17:35 ` Junio C Hamano
2023-07-06 20:54   ` Matthew Hughes
2023-07-06 21:00     ` Matthew Hughes
2023-07-06 21:01     ` Junio C Hamano
2023-07-07  8:45       ` Matthew Hughes
2023-07-07 17:23         ` Junio C Hamano
2023-07-07 19:28           ` Eric Sunshine
2023-07-08 12:42           ` Matthew Hughes

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.