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

1 messages from 2026-10-30 to 2026-10-30. Participants: Okhuomon Ajayi.
Thread: https://gitlist.dev/t/66719

## Okhuomon Ajayi, 2026-10-30 18:32

Subject: [Outreachy PATCH] name-hash: use istate->repo instead of the_repository
Message-ID: <20261030183218.32630-1-okhuomonajayi54@gmail.com>
URL: https://gitlist.dev/e/20261030183218.32630-1-okhuomonajayi54%40gmail.com

```
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(-)

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



```
