threads / patch / 66719

patchname-hash: use istate->repo instead of the_repository

Subject: [Outreachy PATCH] name-hash: use istate->repo instead of the_repository

## tl;dr

One message between Oct 30, 2026 and Oct 30, 2026. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Okhuomon Ajayi· Oct 30, 2026, 18:32 UTC · lore

hash_index_entry(), lookup_lazy_params(), and remove_name_hash() already receive the index, but read core.ignoreCase through the_repository. The setting belongs to the repository that owns the index. An index for another repository would still follow the setting of the_repository.

Read it from istate->repo instead. Drop USE_THE_REPOSITORY_VARIABLE, as nothing else in the file uses the_repository.

Signed-off-by: Okhuomon Ajayi <okhuomonajayi54@gmail.com>
---
I checked whether istate->repo can be NULL here: it is set whenever
an index is initialized, and repo_ignore_case() returns 0 for a NULL
repository anyway.
 name-hash.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
Show changes to name-hash.c +3 −4
diff --git a/name-hash.c b/name-hash.c
index 83757db874..98e170851e 100644
--- a/name-hash.c
+++ b/name-hash.c
@@ -6,7 +6,6 @@
  * Copyright (C) 2008 Linus Torvalds
  */
 
-#define USE_THE_REPOSITORY_VARIABLE
 #define DISABLE_SIGN_COMPARE_WARNINGS
 
 #include "git-compat-util.h"
@@ -126,7 +125,7 @@ static void hash_index_entry(struct index_state *istate, struct cache_entry *ce)
 		hashmap_add(&istate->name_hash, &ce->ent);
 	}
 
-	if (repo_ignore_case(the_repository))
+	if (repo_ignore_case(istate->repo))
 		add_dir_entry(istate, ce);
 }
 
@@ -207,7 +206,7 @@ static int lookup_lazy_params(struct index_state *istate)
 	 * code to build the "istate->name_hash".  We don't
 	 * need the complexity here.
 	 */
-	if (!repo_ignore_case(the_repository))
+	if (!repo_ignore_case(istate->repo))
 		return 0;
 
 	nr_cpus = online_cpus();
@@ -651,7 +650,7 @@ void remove_name_hash(struct index_state *istate, struct cache_entry *ce)
 	ce->ce_flags &= ~CE_HASHED;
 	hashmap_remove(&istate->name_hash, &ce->ent, ce);
 
-	if (repo_ignore_case(the_repository))
+	if (repo_ignore_case(istate->repo))
 		remove_dir_entry(istate, ce);
 }
 

base-commit: b9e5cff1803ab24582201ef059516eb16014b9d9
-- 
2.56.0

← back to recent threads