<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/pathspec.h, branch jch</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=jch</id>
<link rel='self' href='https://git.shady.money/git/atom?h=jch'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2025-05-22T21:20:11Z</updated>
<entry>
<title>pathspec: add flag to indicate operation without repository</title>
<updated>2025-05-22T21:20:11Z</updated>
<author>
<name>Jacob Keller</name>
<email>jacob.keller@gmail.com</email>
</author>
<published>2025-05-21T23:29:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=00466c162082c4c5f2ea96384a9f51147e1c874b'/>
<id>urn:sha1:00466c162082c4c5f2ea96384a9f51147e1c874b</id>
<content type='text'>
A following change will add support for pathspecs to the git diff
--no-index command. This mode of git diff does not load any repository.

Add a new PATHSPEC_NO_REPOSITORY flag indicating that we're parsing
pathspecs without a repository.

Both PATHSPEC_ATTR and PATHSPEC_FROMTOP require a repository to
function. Thus, verify that both of these are set in magic_mask to
ensure they won't be accepted when PATHSPEC_NO_REPOSITORY is set.

Check PATHSPEC_NO_REPOSITORY when warning about paths outside the
directory tree. When the flag is set, do not look for a git repository
when generating the warning message.

Finally, add a BUG in match_pathspec_item if the istate is NULL but the
pathspec has PATHSPEC_ATTR set. Callers which support PATHSPEC_ATTR
should always pass a valid istate, and callers which don't pass a valid
istate should have set PATHSPEC_ATTR in the magic_mask field to disable
support for attribute-based pathspecs.

Signed-off-by: Jacob Keller &lt;jacob.keller@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pathspec: add match_leading_pathspec variant</title>
<updated>2025-05-22T21:20:11Z</updated>
<author>
<name>Jacob Keller</name>
<email>jacob.keller@gmail.com</email>
</author>
<published>2025-05-21T23:29:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6e4fb00156a3651ff84d19d2a16d69e87d29b68b'/>
<id>urn:sha1:6e4fb00156a3651ff84d19d2a16d69e87d29b68b</id>
<content type='text'>
The do_match_pathspec() function has the DO_MATCH_LEADING_PATHSPEC
option to allow pathspecs to match when matching "src" against a
pathspec like "src/path/...". This support is not exposed by
match_pathspec, and the internal flags to do_match_pathspec are not
exposed outside of dir.c

The upcoming support for pathspecs in git diff --no-index need the
LEADING matching behavior when iterating down through a directory with
readdir.

We could try to expose the match_pathspec_with_flags to the public API.
However, DO_MATCH_EXCLUDES really shouldn't be public, and its a bit
weird to only have a few of the flags become public.

Instead, add match_leading_pathspec() as a function which sets both
DO_MATCH_DIRECTORY and DO_MATCH_LEADING_PATHSPEC when is_dir is true.

This will be used in a following change to support pathspec matching in
git diff --no-index.

Signed-off-by: Jacob Keller &lt;jacob.keller@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'as/pathspec-h-typofix'</title>
<updated>2024-07-12T15:41:57Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-07-12T15:41:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7c01dcd0180952c7bdf87cab1dba7b36d951ca24'/>
<id>urn:sha1:7c01dcd0180952c7bdf87cab1dba7b36d951ca24</id>
<content type='text'>
Typofix.

* as/pathspec-h-typofix:
  pathspec: fix typo "glossary-context.txt" -&gt; "glossary-content.txt"
</content>
</entry>
<entry>
<title>pathspec: fix typo "glossary-context.txt" -&gt; "glossary-content.txt"</title>
<updated>2024-07-01T19:19:26Z</updated>
<author>
<name>Abhijeet Sonar</name>
<email>abhijeet.nkt@gmail.com</email>
</author>
<published>2024-06-29T19:31:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=231cf7370ed9ac81814d66bc09c06e2399255784'/>
<id>urn:sha1:231cf7370ed9ac81814d66bc09c06e2399255784</id>
<content type='text'>
The pathspec syntax is explained in the file "glossary-content.txt".
Moreover, no file named "glossary-context.txt" exists in the repository.

Signed-off-by: Abhijeet Sonar &lt;abhijeet.nkt@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/log-follow-with-non-literal-pathspec'</title>
<updated>2023-06-20T22:53:13Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-06-20T22:53:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=de00f4b7f3fd3aca18e4bea286bf060c595efd3b'/>
<id>urn:sha1:de00f4b7f3fd3aca18e4bea286bf060c595efd3b</id>
<content type='text'>
"git [-c log.follow=true] log [--follow] ':(glob)f**'" used to barf.

* jk/log-follow-with-non-literal-pathspec:
  diff: detect pathspec magic not supported by --follow
  diff: factor out --follow pathspec check
  pathspec: factor out magic-to-name function
</content>
</entry>
<entry>
<title>pathspec: factor out magic-to-name function</title>
<updated>2023-06-03T01:34:25Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2023-06-01T17:38:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8e32caaa783a3a6b1d94834ee6e2d21ac36ff39f'/>
<id>urn:sha1:8e32caaa783a3a6b1d94834ee6e2d21ac36ff39f</id>
<content type='text'>
When we have unsupported magic in a pathspec (because a command or code
path does not support particular items), we list the unsupported ones in
an error message.

Let's factor out the code here that converts the bits back into their
human-readable names, so that it can be used from other callers, which
may want to provide more flexible error messages.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>dir.h: refactor to no longer need to include cache.h</title>
<updated>2023-02-24T01:25:29Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2023-02-24T00:09:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ac48adf488794417b1060b5ed2377a9fd4c33c17'/>
<id>urn:sha1:ac48adf488794417b1060b5ed2377a9fd4c33c17</id>
<content type='text'>
Moving a few functions around allows us to make dir.h no longer need to
include cache.h.  This commit is best viewed with:
    git log -1 -p --color-moved

Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pathspec.h: move pathspec_needs_expanded_index() from reset.c to here</title>
<updated>2022-08-08T20:23:26Z</updated>
<author>
<name>Shaoxuan Yuan</name>
<email>shaoxuan.yuan02@gmail.com</email>
</author>
<published>2022-08-07T04:13:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b29ad38322d37925d217314383352c5341422a1c'/>
<id>urn:sha1:b29ad38322d37925d217314383352c5341422a1c</id>
<content type='text'>
Method pathspec_needs_expanded_index() in reset.c from 4d1cfc1351
(reset: make --mixed sparse-aware, 2021-11-29) is reusable when we
need to verify if the index needs to be expanded when the command
is utilizing a pathspec rather than a literal path.

Move it to pathspec.h for reusability.

Add a few items to the function so it can better serve its purpose as
a standalone public function:

* Add a check in front so if the index is not sparse, return early since
  no expansion is needed.

* It now takes an arbitrary 'struct index_state' pointer instead of
  using `the_index` and `active_cache`.

* Add documentation to the function.

Helped-by: Victoria Dye &lt;vdye@github.com&gt;
Helped-by: Derrick Stolee &lt;derrickstolee@github.com&gt;
Signed-off-by: Shaoxuan Yuan &lt;shaoxuan.yuan02@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pathspec: use BUG(...) not die("BUG:%s:%d....", &lt;file&gt;, &lt;line&gt;)</title>
<updated>2021-12-07T20:31:17Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-12-07T11:05:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a78537a0f26615b69b680845cfbb765cc665c808'/>
<id>urn:sha1:a78537a0f26615b69b680845cfbb765cc665c808</id>
<content type='text'>
Change code that was added in 8f4f8f4579f (guard against new pathspec
magic in pathspec matching code, 2013-07-14) to use the BUG() macro
instead of emitting a "fatal" message with the "__FILE__"-name and
"__LINE__"-numbers.

The original code predated the existence of the BUG() function, which
was added in d8193743e08 (usage.c: add BUG() function, 2017-05-12).

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ds/gender-neutral-doc'</title>
<updated>2021-07-17T00:42:53Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-07-17T00:42:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8e62a85352e998415934ac24c6b0db3cd37d372e'/>
<id>urn:sha1:8e62a85352e998415934ac24c6b0db3cd37d372e</id>
<content type='text'>
Update the documentation not to assume users are of certain gender
and adds to guidelines to do so.

* ds/gender-neutral-doc:
  *: fix typos
  comments: avoid using the gender of our users
  doc: avoid using the gender of other people
</content>
</entry>
</feed>
