aboutsummaryrefslogtreecommitdiffstats
path: root/dir.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2021-07-30 21:06:58 +0200
committerJunio C Hamano <gitster@pobox.com>2021-07-30 12:14:27 -0700
commit74318423259b265cf95112355be254fa21d4a6f9 (patch)
tree08bf1af2853a7ed4b57c8f148b28fa62899d1378 /dir.c
parent940fe202adcbf9fa1825c648d97cbe1b90d26aec (diff)
downloadgit-74318423259b265cf95112355be254fa21d4a6f9.tar.gz
use fspathhash() everywhere
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 <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/dir.c b/dir.c
index 23b4417268..03c4d21267 100644
--- a/dir.c
+++ b/dir.c
@@ -782,9 +782,7 @@ static void add_pattern_to_hashsets(struct pattern_list *pl, struct path_pattern
translated->pattern = truncated;
translated->patternlen = given->patternlen - 2;
hashmap_entry_init(&translated->ent,
- ignore_case ?
- strihash(translated->pattern) :
- strhash(translated->pattern));
+ fspathhash(translated->pattern));
if (!hashmap_get_entry(&pl->recursive_hashmap,
translated, ent, NULL)) {
@@ -813,9 +811,7 @@ static void add_pattern_to_hashsets(struct pattern_list *pl, struct path_pattern
translated->pattern = dup_and_filter_pattern(given->pattern);
translated->patternlen = given->patternlen;
hashmap_entry_init(&translated->ent,
- ignore_case ?
- strihash(translated->pattern) :
- strhash(translated->pattern));
+ fspathhash(translated->pattern));
hashmap_add(&pl->recursive_hashmap, &translated->ent);
@@ -845,10 +841,7 @@ static int hashmap_contains_path(struct hashmap *map,
/* Check straight mapping */
p.pattern = pattern->buf;
p.patternlen = pattern->len;
- hashmap_entry_init(&p.ent,
- ignore_case ?
- strihash(p.pattern) :
- strhash(p.pattern));
+ hashmap_entry_init(&p.ent, fspathhash(p.pattern));
return !!hashmap_get_entry(map, &p, ent, NULL);
}