]> git.ipfire.org Git - thirdparty/git.git/blobdiff - name-hash.c
Start the 2.46 cycle
[thirdparty/git.git] / name-hash.c
index 251f036eef6983a66ac13013e5bee3ef770e8f9f..3a58ce03d9c4a6721941f0ff8b262b6ddb73acd2 100644 (file)
@@ -685,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;
 }