<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/dir.c, branch v2.33.6</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.33.6</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.33.6'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2021-07-30T19:14:27Z</updated>
<entry>
<title>use fspathhash() everywhere</title>
<updated>2021-07-30T19:14:27Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2021-07-30T19:06:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=74318423259b265cf95112355be254fa21d4a6f9'/>
<id>urn:sha1:74318423259b265cf95112355be254fa21d4a6f9</id>
<content type='text'>
cf2dc1c238 (speed up alt_odb_usable() with many alternates, 2021-07-07)
introduced the function fspathhash() for calculating path hashes while
respecting the configuration option core.ignorecase.  Call it instead of
open-coding it; the resulting code is shorter and less repetitive.

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ds/status-with-sparse-index'</title>
<updated>2021-07-28T20:18:02Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-07-28T20:18:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b271a3034fc54a7c84ae5803d72f14a29b172c78'/>
<id>urn:sha1:b271a3034fc54a7c84ae5803d72f14a29b172c78</id>
<content type='text'>
"git status" codepath learned to work with sparsely populated index
without hydrating it fully.

* ds/status-with-sparse-index:
  t1092: document bad sparse-checkout behavior
  fsmonitor: integrate with sparse index
  wt-status: expand added sparse directory entries
  status: use sparse-index throughout
  status: skip sparse-checkout percentage with sparse-index
  diff-lib: handle index diffs with sparse dirs
  dir.c: accept a directory as part of cone-mode patterns
  unpack-trees: unpack sparse directory entries
  unpack-trees: rename unpack_nondirectories()
  unpack-trees: compare sparse directories correctly
  unpack-trees: preserve cache_bottom
  t1092: add tests for status/add and sparse files
  t1092: expand repository data shape
  t1092: replace incorrect 'echo' with 'cat'
  sparse-index: include EXTENDED flag when expanding
  sparse-index: skip indexes with unmerged entries
</content>
</entry>
<entry>
<title>Merge branch 'ew/many-alternate-optim'</title>
<updated>2021-07-28T20:17:57Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-07-28T20:17:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e5cc59c77c875aeda93a3cdfe70c8254164324ab'/>
<id>urn:sha1:e5cc59c77c875aeda93a3cdfe70c8254164324ab</id>
<content type='text'>
Optimization for repositories with many alternate object store.

* ew/many-alternate-optim:
  oidtree: a crit-bit tree for odb_loose_cache
  oidcpy_with_padding: constify `src' arg
  make object_directory.loose_objects_subdir_seen a bitmap
  avoid strlen via strbuf_addstr in link_alt_odb_entry
  speed up alt_odb_usable() with many alternates
</content>
</entry>
<entry>
<title>dir.c: accept a directory as part of cone-mode patterns</title>
<updated>2021-07-14T20:42:49Z</updated>
<author>
<name>Derrick Stolee</name>
<email>dstolee@microsoft.com</email>
</author>
<published>2021-07-14T13:12:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=69bdbdb0ee25bd64bd3ad2fe241d434442e96f75'/>
<id>urn:sha1:69bdbdb0ee25bd64bd3ad2fe241d434442e96f75</id>
<content type='text'>
When we have sparse directory entries in the index, we want to compare
that directory against sparse-checkout patterns. Those pattern matching
algorithms are built expecting a file path, not a directory path. This
is especially important in the "cone mode" patterns which will match
files that exist within the "parent directories" as well as the
recursive directory matches.

If path_matches_pattern_list() is given a directory, we can add a fake
filename ("-") to the directory and get the same results as before,
assuming we are in cone mode. Since sparse index requires cone mode
patterns, this is an acceptable assumption.

Reviewed-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Derrick Stolee &lt;dstolee@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>speed up alt_odb_usable() with many alternates</title>
<updated>2021-07-08T00:21:12Z</updated>
<author>
<name>Eric Wong</name>
<email>e@80x24.org</email>
</author>
<published>2021-07-07T23:10:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cf2dc1c238c6fd5f93c315a3045ccf95459701cd'/>
<id>urn:sha1:cf2dc1c238c6fd5f93c315a3045ccf95459701cd</id>
<content type='text'>
With many alternates, the duplicate check in alt_odb_usable()
wastes many cycles doing repeated fspathcmp() on every existing
alternate.  Use a khash to speed up lookups by odb-&gt;path.

Since the kh_put_* API uses the supplied key without
duplicating it, we also take advantage of it to replace both
xstrdup() and strbuf_release() in link_alt_odb_entry() with
strbuf_detach() to avoid the allocation and copy.

In a test repository with 50K alternates and each of those 50K
alternates having one alternate each (for a total of 100K total
alternates); this speeds up lookup of a non-existent blob from
over 16 minutes to roughly 2.7 seconds on my busy workstation.

Note: all underlying git object directories were small and
unpacked with only loose objects and no packs.  Having to load
packs increases times significantly.

Signed-off-by: Eric Wong &lt;e@80x24.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>dir.[ch]: replace dir_init() with DIR_INIT</title>
<updated>2021-07-01T19:32:22Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-07-01T10:51:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ce93a4c6127abdf1ad9eacd537edd1c571a18e41'/>
<id>urn:sha1:ce93a4c6127abdf1ad9eacd537edd1c571a18e41</id>
<content type='text'>
Remove the dir_init() function and replace it with a DIR_INIT
macro. In many cases in the codebase we need to initialize things with
a function for good reasons, e.g. needing to call another function on
initialization. The "dir_init()" function was not one such case, and
could trivially be replaced with a more idiomatic macro initialization
pattern.

The only place where we made use of its use of memset() was in
dir_clear() itself, which resets the contents of an an existing struct
pointer. Let's use the new "memcpy() a 'blank' struct on the stack"
idiom to do that reset.

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 'en/dir-traversal'</title>
<updated>2021-05-28T04:03:00Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-05-28T04:03:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=329d63e7be044524d29dcb43e8ed52bc1f3b9241'/>
<id>urn:sha1:329d63e7be044524d29dcb43e8ed52bc1f3b9241</id>
<content type='text'>
Fix-up to a topic that is already in 'master'.

* en/dir-traversal:
  dir: introduce readdir_skip_dot_and_dotdot() helper
  dir: update stale description of treat_directory()
  Revert "dir: update stale description of treat_directory()"
  Revert "dir: introduce readdir_skip_dot_and_dotdot() helper"
</content>
</entry>
<entry>
<title>dir: introduce readdir_skip_dot_and_dotdot() helper</title>
<updated>2021-05-27T05:02:37Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2021-05-27T04:53:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=906fc557b70b2b2995785c9b37e212d2f86b469e'/>
<id>urn:sha1:906fc557b70b2b2995785c9b37e212d2f86b469e</id>
<content type='text'>
Many places in the code were doing
    while ((d = readdir(dir)) != NULL) {
        if (is_dot_or_dotdot(d-&gt;d_name))
            continue;
        ...process d...
    }
Introduce a readdir_skip_dot_and_dotdot() helper to make that a one-liner:
    while ((d = readdir_skip_dot_and_dotdot(dir)) != NULL) {
        ...process d...
    }

This helper particularly simplifies checks for empty directories.

Also use this helper in read_cached_dir() so that our statistics are
consistent across platforms.  (In other words, read_cached_dir() should
have been using is_dot_or_dotdot() and skipping such entries, but did
not and left it to treat_path() to detect and mark such entries as
path_none.)

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>dir: update stale description of treat_directory()</title>
<updated>2021-05-27T05:02:37Z</updated>
<author>
<name>Derrick Stolee</name>
<email>stolee@gmail.com</email>
</author>
<published>2021-05-27T04:53:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=eef814828f175290ca1fcd17ad74faff95346c85'/>
<id>urn:sha1:eef814828f175290ca1fcd17ad74faff95346c85</id>
<content type='text'>
The documentation comment for treat_directory() was originally written
in 095952 (Teach directory traversal about subprojects, 2007-04-11)
which was before the 'struct dir_struct' split its bitfield of named
options into a 'flags' enum in 7c4c97c0 (Turn the flags in struct
dir_struct into a single variable, 2009-02-16). When those flags
changed, the comment became stale, since members like
'show_other_directories' transitioned into flags like
DIR_SHOW_OTHER_DIRECTORIES.

Update the comments for treat_directory() to use these flag names rather
than the old member names.

Signed-off-by: Derrick Stolee &lt;dstolee@microsoft.com&gt;
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>Revert "dir: update stale description of treat_directory()"</title>
<updated>2021-05-27T05:02:37Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-05-27T05:00:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2c9f1bfdb47acde21052bb33ff083347cbcb574d'/>
<id>urn:sha1:2c9f1bfdb47acde21052bb33ff083347cbcb574d</id>
<content type='text'>
This reverts commit 4e689d81718eb6e939cace317ea3e33cb994dcbb,
to be replaced with a reworked version.
</content>
</entry>
</feed>
