summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorEric Sunshine <sunshine@sunshineco.com>2013-09-17 03:06:15 -0400
committerJunio C Hamano <gitster@pobox.com>2013-09-17 10:07:37 -0700
commitebbd7439b1b7cce0e8c68fe3e220d71cc58dd980 (patch)
treee1a20a77e2954c058cb50e0f5abcff7f0fe99ded /read-cache.c
parentdb5360f3f4966c4586d072bd1440880773185b81 (diff)
downloadgit-ebbd7439b1b7cce0e8c68fe3e220d71cc58dd980.tar.gz
employ new explicit "exists in index?" API
Each caller of index_name_exists() knows whether it is looking for a directory or a file, and can avoid the unnecessary indirection of index_name_exists() by instead calling index_dir_exists() or index_file_exists() directly. Invoking the appropriate search function explicitly will allow a subsequent patch to relieve callers of the artificial burden of having to add a trailing '/' to the pathname given to index_dir_exists(). Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/read-cache.c b/read-cache.c
index 885943a6df..b8d3759b53 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -643,7 +643,7 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st,
if (*ptr == '/') {
struct cache_entry *foundce;
++ptr;
- foundce = index_name_exists(istate, ce->name, ptr - ce->name, ignore_case);
+ foundce = index_dir_exists(istate, ce->name, ptr - ce->name);
if (foundce) {
memcpy((void *)startPtr, foundce->name + (startPtr - ce->name), ptr - startPtr);
startPtr = ptr;
@@ -652,7 +652,7 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st,
}
}
- alias = index_name_exists(istate, ce->name, ce_namelen(ce), ignore_case);
+ alias = index_file_exists(istate, ce->name, ce_namelen(ce), ignore_case);
if (alias && !ce_stage(alias) && !ie_match_stat(istate, alias, st, ce_option)) {
/* Nothing changed, really */
free(ce);