<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/dir.c, branch main</title>
<subtitle>Fork of git SCM with my patches.</subtitle>
<id>http://git.kilabit.info/git/atom?h=main</id>
<link rel='self' href='http://git.kilabit.info/git/atom?h=main'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/'/>
<updated>2026-03-23T16:20:29Z</updated>
<entry>
<title>Merge branch 'cf/constness-fixes'</title>
<updated>2026-03-23T16:20:29Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-03-23T16:20:29Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=651847f5bcf468e06f4153a438892e517e005dde'/>
<id>urn:sha1:651847f5bcf468e06f4153a438892e517e005dde</id>
<content type='text'>
Small code clean-up around the constness area.

* cf/constness-fixes:
  dir: avoid -Wdiscarded-qualifiers in remove_path()
  bloom: remove a misleading const qualifier
</content>
</entry>
<entry>
<title>dir: avoid -Wdiscarded-qualifiers in remove_path()</title>
<updated>2026-03-10T04:52:07Z</updated>
<author>
<name>Collin Funk</name>
<email>collin.funk1@gmail.com</email>
</author>
<published>2026-03-09T03:23:06Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=02cbae61df7b3493e7f76f8385fc9257de60755f'/>
<id>urn:sha1:02cbae61df7b3493e7f76f8385fc9257de60755f</id>
<content type='text'>
When building with glibc-2.43 there is the following warning:

    dir.c:3526:15: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     3526 |         slash = strrchr(name, '/');
          |               ^

In this case we use a non-const pointer to get the last slash of the
unwritable file name, and then use it again to write in the strdup'd
file name.

We can avoid this warning and make the code a bit more clear by using a
separate variable to access the original argument and its strdup'd
copy.

Signed-off-by: Collin Funk &lt;collin.funk1@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>environment: stop using core.sparseCheckout globally</title>
<updated>2026-02-26T15:22:51Z</updated>
<author>
<name>Olamide Caleb Bello</name>
<email>belkid98@gmail.com</email>
</author>
<published>2026-02-16T16:38:26Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=4021751558126d39b642503e7ef4768131df45e7'/>
<id>urn:sha1:4021751558126d39b642503e7ef4768131df45e7</id>
<content type='text'>
The config value `core.sparseCheckout` is parsed in
`git_default_core_config()` and stored globally in
`core_apply_sparse_checkout`. This could cause it to be overwritten
by another repository when different Git repositories run in the same
process.

Move the parsed value into `struct repo_config_values` in the_repository
to retain current behaviours and move towards libifying Git.

Suggested-by: Phillip Wood &lt;phillip.wood123@gmail.com&gt;
Mentored-by: Christian Couder &lt;christian.couder@gmail.com&gt;
Mentored-by: Usman Akinyemi &lt;usmanakinyemi202@gmail.com&gt;
Signed-off-by: Olamide Caleb Bello &lt;belkid98@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/match-pathname-fix'</title>
<updated>2025-11-03T14:49:55Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-11-03T14:49:54Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=52364670907b84f91bcd42035ddd30ceac0f2771'/>
<id>urn:sha1:52364670907b84f91bcd42035ddd30ceac0f2771</id>
<content type='text'>
The wildmatch code had a corner case bug that mistakenly makes
"foo**/bar" match with "foobar", which has been corrected.

* jk/match-pathname-fix:
  match_pathname(): give fnmatch one char of prefix context
  match_pathname(): reorder prefix-match check
</content>
</entry>
<entry>
<title>Merge branch 'ds/sparse-checkout-clean'</title>
<updated>2025-10-28T17:29:09Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-10-28T17:29:08Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=54ac3809c366e4831609ac094780c0bdc8f9f0db'/>
<id>urn:sha1:54ac3809c366e4831609ac094780c0bdc8f9f0db</id>
<content type='text'>
"git sparse-checkout" subcommand learned a new "clean" action to
prune otherwise unused working-tree files that are outside the
areas of interest.

* ds/sparse-checkout-clean:
  sparse-index: improve advice message instructions
  t: expand tests around sparse merges and clean
  sparse-index: point users to new 'clean' action
  sparse-checkout: add --verbose option to 'clean'
  dir: add generic "walk all files" helper
  sparse-checkout: match some 'clean' behavior
  sparse-checkout: add basics of 'clean' command
  sparse-checkout: remove use of the_repository
</content>
</entry>
<entry>
<title>match_pathname(): give fnmatch one char of prefix context</title>
<updated>2025-10-26T23:32:43Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2025-10-26T15:42:22Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=1940a02dc1122d15706a7051ee47e73f329fb4f7'/>
<id>urn:sha1:1940a02dc1122d15706a7051ee47e73f329fb4f7</id>
<content type='text'>
In match_pathname(), which we use for matching .gitignore and
.gitattribute patterns, we are comparing paths with fnmatch patterns
(actually our extended wildmatch, which will be important).  There's an
extra optimization there: we pre-compute the number of non-wildcard
characters at the beginning of the pattern and do an fspathncmp() on
that prefix.

That lets us avoid fnmatch entirely on patterns without wildcards, and
shrinks the amount of work we hand off to fnmatch. For a pattern like
"foo*.txt" and a path "foobar.txt", we'd cut away the matching "foo"
prefix and just pass "*.txt" and "bar.txt" to fnmatch().

But this misses a subtle corner case. In fnmatch(), we'll think
"bar.txt" is the start of the path, but it's not. This doesn't matter
for the pattern above, but consider the wildmatch pattern "foo**/bar"
and the path "foobar". These two should not match, because there is no
file named "bar", and the "**" applies only to the containing directory
name. But after removing the "foo" prefix, fnmatch will get "**/bar" and
"bar", which it does consider a match, because "**/" can match zero
directories.

We can solve this by giving fnmatch a bit more context. As long as it
has one byte of the matched prefix, then it will know that "bar" is not
the start of the path. In this example it would get "o**/bar" and
"obar", and realize that they cannot match.

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>match_pathname(): reorder prefix-match check</title>
<updated>2025-10-26T23:30:39Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2025-10-26T15:41:46Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=9d6c580d01800defbd9497dbe6a694dc31179dce'/>
<id>urn:sha1:9d6c580d01800defbd9497dbe6a694dc31179dce</id>
<content type='text'>
As an optimization, we use fspathncmp() to match a prefix of the pattern
that does not contain any wildcards, and then pass the remainder to
fnmatch(). If it has matched the whole thing, we can return early.

Let's shift this early-return check to before we tweak the pattern and
name strings. That will gives us more flexibility with that tweaking.

It might also save a few instructions, but I couldn't measure any
improvement in doing so (and I wouldn't be surprised if an optimizing
compiler could figure that out itself).

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>varint: use explicit width for integers</title>
<updated>2025-10-02T16:32:32Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-10-02T07:29:30Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=f366bfe16b350240c70c487d180c76ddcb8a1b2d'/>
<id>urn:sha1:f366bfe16b350240c70c487d180c76ddcb8a1b2d</id>
<content type='text'>
The varint subsystem currently uses implicit widths for integers. On the
one hand we use `uintmax_t` for the actual value. On the other hand, we
use `int` for the length of the encoded varint.

Both of these have known maximum values, as we only support at most 16
bytes when encoding varints. Thus, we know that we won't ever exceed
`uint64_t` for the actual value and `uint8_t` for the prefix length.

Refactor the code to use explicit widths. Besides making the logic
platform-independent, it also makes our life a bit easier in the next
commit, where we reimplement "varint.c" in Rust.

Suggested-by: Ezekiel Newren &lt;ezekielnewren@gmail.com&gt;
Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>dir: add generic "walk all files" helper</title>
<updated>2025-09-12T15:59:52Z</updated>
<author>
<name>Derrick Stolee</name>
<email>stolee@gmail.com</email>
</author>
<published>2025-09-12T10:30:08Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=1588e836bb956d14e6cb38e35933ed2749c023b4'/>
<id>urn:sha1:1588e836bb956d14e6cb38e35933ed2749c023b4</id>
<content type='text'>
There is sometimes a need to visit every file within a directory,
recursively. The main example is remove_dir_recursively(), though it has
some extra flags that make it want to iterate over paths in a custom
way. There is also the fill_directory() approach but that involves an
index and a pathspec.

This change adds a new for_each_file_in_dir() method that will be
helpful in the next change.

Signed-off-by: Derrick Stolee &lt;stolee@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'tc/diff-tree-max-depth'</title>
<updated>2025-08-25T21:22:01Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-08-25T21:22:00Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=109c3df14ccf372c2438a470bdfb566265399f0a'/>
<id>urn:sha1:109c3df14ccf372c2438a470bdfb566265399f0a</id>
<content type='text'>
"git diff-tree" learned "--max-depth" option.

* tc/diff-tree-max-depth:
  diff: teach tree-diff a max-depth parameter
  within_depth: fix return for empty path
  combine-diff: zero memory used for callback filepairs
</content>
</entry>
</feed>
