diff options
Diffstat (limited to 'name-hash.c')
| -rw-r--r-- | name-hash.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/name-hash.c b/name-hash.c index cd009c7c8a..3a58ce03d9 100644 --- a/name-hash.c +++ b/name-hash.c @@ -5,8 +5,14 @@ * * Copyright (C) 2008 Linus Torvalds */ -#include "cache.h" +#include "git-compat-util.h" +#include "environment.h" +#include "gettext.h" +#include "name-hash.h" +#include "object.h" +#include "read-cache-ll.h" #include "thread-utils.h" +#include "trace.h" #include "trace2.h" #include "sparse-index.h" @@ -679,13 +685,20 @@ static int same_name(const struct cache_entry *ce, const char *name, int namelen return slow_same_name(name, namelen, ce->name, len); } -int index_dir_exists(struct index_state *istate, const char *name, int namelen) +int index_dir_find(struct index_state *istate, const char *name, int namelen, + struct strbuf *canonical_path) { struct dir_entry *dir; lazy_init_name_hash(istate); expand_to_path(istate, name, namelen, 0); dir = find_dir_entry(istate, name, namelen); + + if (canonical_path && dir && dir->nr) { + strbuf_reset(canonical_path); + strbuf_add(canonical_path, dir->name, dir->namelen); + } + return dir && dir->nr; } |
