summaryrefslogtreecommitdiff
path: root/dir.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 /dir.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 'dir.c')
-rw-r--r--dir.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/dir.c b/dir.c
index b439ff0e63..a8401b97ce 100644
--- a/dir.c
+++ b/dir.c
@@ -860,7 +860,7 @@ static struct dir_entry *dir_entry_new(const char *pathname, int len)
static struct dir_entry *dir_add_name(struct dir_struct *dir, const char *pathname, int len)
{
- if (cache_name_exists(pathname, len, ignore_case))
+ if (cache_file_exists(pathname, len, ignore_case))
return NULL;
ALLOC_GROW(dir->entries, dir->nr+1, dir->alloc);
@@ -885,11 +885,11 @@ enum exist_status {
/*
* Do not use the alphabetically sorted index to look up
* the directory name; instead, use the case insensitive
- * name hash.
+ * directory hash.
*/
static enum exist_status directory_exists_in_index_icase(const char *dirname, int len)
{
- const struct cache_entry *ce = cache_name_exists(dirname, len + 1, ignore_case);
+ const struct cache_entry *ce = cache_dir_exists(dirname, len + 1);
unsigned char endchar;
if (!ce)
@@ -1071,7 +1071,7 @@ static int get_index_dtype(const char *path, int len)
int pos;
const struct cache_entry *ce;
- ce = cache_name_exists(path, len, 0);
+ ce = cache_file_exists(path, len, 0);
if (ce) {
if (!ce_uptodate(ce))
return DT_UNKNOWN;
@@ -1131,7 +1131,7 @@ static enum path_treatment treat_one_path(struct dir_struct *dir,
int dtype, struct dirent *de)
{
int exclude;
- int has_path_in_index = !!cache_name_exists(path->buf, path->len, ignore_case);
+ int has_path_in_index = !!cache_file_exists(path->buf, path->len, ignore_case);
if (dtype == DT_UNKNOWN)
dtype = get_dtype(de, path->buf, path->len);