git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] name-hash: don't add sparse directories in threaded lazy init
@ 2025-05-21 11:40 Alex Mironov via GitGitGadget
  2025-05-21 17:17 ` Derrick Stolee
  2025-05-21 20:16 ` [PATCH v2] " Alex Mironov via GitGitGadget
  0 siblings, 2 replies; 13+ messages in thread
From: Alex Mironov via GitGitGadget @ 2025-05-21 11:40 UTC (permalink / raw)
  To: git; +Cc: Derrick Stolee, Junio C Hamano, Alex Mironov, Alex Mironov

From: Alex Mironov <alexandrfox@gmail.com>

Similarly to 5f116695864788d1fe45ff06bfad7a71a8d98d0a
make sure to avoid placing sparse directories into the name_hash
hashtable whenever multithreaded initialization is performed.

Sparse directory entries represent a directory that is outside the
sparse-checkout definition. These are not paths to blobs, so should not
be added to the name_hash table as they must never be queried.

Signed-off-by: Alex Mironov <alexandrfox@gmail.com>
---
    name-hash: don't add sparse directories in threaded lazy init

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1970%2Falexandrfox%2Ffix-threaded-hash-name-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1970/alexandrfox/fix-threaded-hash-name-v1
Pull-Request: https://github.com/git/git/pull/1970

 name-hash.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/name-hash.c b/name-hash.c
index d66de1cdfd5..03123a8779a 100644
--- a/name-hash.c
+++ b/name-hash.c
@@ -492,6 +492,9 @@ static void *lazy_name_thread_proc(void *_data)
 	for (k = 0; k < d->istate->cache_nr; k++) {
 		struct cache_entry *ce_k = d->istate->cache[k];
 		ce_k->ce_flags |= CE_HASHED;
+		if (S_ISSPARSEDIR(ce_k->ce_mode)) {
+			continue;
+		}
 		hashmap_entry_init(&ce_k->ent, d->lazy_entries[k].hash_name);
 		hashmap_add(&d->istate->name_hash, &ce_k->ent);
 	}

base-commit: 8613c2bb6cd16ef530dc5dd74d3b818a1ccbf1c0
-- 
gitgitgadget

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

end of thread, other threads:[~2025-05-22  1:48 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-21 11:40 [PATCH] name-hash: don't add sparse directories in threaded lazy init Alex Mironov via GitGitGadget
2025-05-21 17:17 ` Derrick Stolee
2025-05-21 18:32   ` Junio C Hamano
2025-05-21 20:07   ` Alex Mironov
2025-05-21 20:16 ` [PATCH v2] " Alex Mironov via GitGitGadget
2025-05-21 20:32   ` Junio C Hamano
2025-05-21 20:37     ` Alex Mironov
2025-05-21 21:12       ` Junio C Hamano
2025-05-21 21:23         ` Junio C Hamano
2025-05-21 21:40           ` Alex Mironov
2025-05-21 21:29   ` [PATCH v3] " Alex Mironov via GitGitGadget
2025-05-21 21:47     ` Junio C Hamano
2025-05-22  1:48       ` Derrick Stolee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).