Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2021-07-30 22:06:58 +0300
committerJunio C Hamano <gitster@pobox.com>2021-07-30 22:14:27 +0300
commit74318423259b265cf95112355be254fa21d4a6f9 (patch)
tree08bf1af2853a7ed4b57c8f148b28fa62899d1378 /merge-recursive.c
parent940fe202adcbf9fa1825c648d97cbe1b90d26aec (diff)
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 'merge-recursive.c')
-rw-r--r--merge-recursive.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index 7008a90df5..3355d50e8a 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -61,11 +61,6 @@ static int path_hashmap_cmp(const void *cmp_data,
return strcmp(a->path, key ? key : b->path);
}
-static unsigned int path_hash(const char *path)
-{
- return ignore_case ? strihash(path) : strhash(path);
-}
-
/*
* For dir_rename_entry, directory names are stored as a full path from the
* toplevel of the repository and do not include a trailing '/'. Also:
@@ -463,7 +458,7 @@ static int save_files_dirs(const struct object_id *oid,
strbuf_addstr(base, path);
FLEX_ALLOC_MEM(entry, path, base->buf, base->len);
- hashmap_entry_init(&entry->e, path_hash(entry->path));
+ hashmap_entry_init(&entry->e, fspathhash(entry->path));
hashmap_add(&opt->priv->current_file_dir_set, &entry->e);
strbuf_setlen(base, baselen);
@@ -737,14 +732,14 @@ static char *unique_path(struct merge_options *opt,
base_len = newpath.len;
while (hashmap_get_from_hash(&opt->priv->current_file_dir_set,
- path_hash(newpath.buf), newpath.buf) ||
+ fspathhash(newpath.buf), newpath.buf) ||
(!opt->priv->call_depth && file_exists(newpath.buf))) {
strbuf_setlen(&newpath, base_len);
strbuf_addf(&newpath, "_%d", suffix++);
}
FLEX_ALLOC_MEM(entry, path, newpath.buf, newpath.len);
- hashmap_entry_init(&entry->e, path_hash(entry->path));
+ hashmap_entry_init(&entry->e, fspathhash(entry->path));
hashmap_add(&opt->priv->current_file_dir_set, &entry->e);
return strbuf_detach(&newpath, NULL);
}