]> git.ipfire.org Git - thirdparty/git.git/blobdiff - dir.c
Merge branch 'nd/sha1-name-c-wo-the-repository'
[thirdparty/git.git] / dir.c
diff --git a/dir.c b/dir.c
index 1c488b52003913940b053178b8dce3a06838b0b5..2ccd4db66440ac3b030049571a0cb0a560dfcb3d 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -1466,9 +1466,11 @@ static enum path_treatment treat_directory(struct dir_struct *dir,
                        return path_none;
                }
                if (!(dir->flags & DIR_NO_GITLINKS)) {
-                       struct object_id oid;
-                       if (resolve_gitlink_ref(dirname, "HEAD", &oid) == 0)
+                       struct strbuf sb = STRBUF_INIT;
+                       strbuf_addstr(&sb, dirname);
+                       if (is_nonbare_repository_dir(&sb))
                                return exclude ? path_excluded : path_untracked;
+                       strbuf_release(&sb);
                }
                return path_recurse;
        }
@@ -2314,6 +2316,14 @@ int file_exists(const char *f)
        return lstat(f, &sb) == 0;
 }
 
+int repo_file_exists(struct repository *repo, const char *path)
+{
+       if (repo != the_repository)
+               BUG("do not know how to check file existence in arbitrary repo");
+
+       return file_exists(path);
+}
+
 static int cmp_icase(char a, char b)
 {
        if (a == b)
@@ -2756,7 +2766,7 @@ static int read_one_dir(struct untracked_cache_dir **untracked_,
        next = data + len + 1;
        if (next > rd->end)
                return -1;
-       *untracked_ = untracked = xmalloc(st_add(sizeof(*untracked), len));
+       *untracked_ = untracked = xmalloc(st_add3(sizeof(*untracked), len, 1));
        memcpy(untracked, &ud, sizeof(ud));
        memcpy(untracked->name, data, len + 1);
        data = next;