checkout: generalize die_if_checked_out() branch name argument
[gitweb.git] / path.c
diff --git a/path.c b/path.c
index cd8e2d6e686e41f0a53479bf34d810a1a338650e..a5c51a33bd03158f1ac9624e98e7d6b4ddf32e18 100644 (file)
--- a/path.c
+++ b/path.c
@@ -92,7 +92,7 @@ static void replace_dir(struct strbuf *buf, int len, const char *newdir)
 }
 
 static const char *common_list[] = {
-       "/branches", "/hooks", "/info", "!/logs", "/lost-found", "/modules",
+       "/branches", "/hooks", "/info", "!/logs", "/lost-found",
        "/objects", "/refs", "/remotes", "/worktrees", "/rr-cache", "/svn",
        "config", "!gc.pid", "packed-refs", "shallow",
        NULL
@@ -103,7 +103,8 @@ static void update_common_dir(struct strbuf *buf, int git_dir_len)
        char *base = buf->buf + git_dir_len;
        const char **p;
 
-       if (is_dir_file(base, "logs", "HEAD"))
+       if (is_dir_file(base, "logs", "HEAD") ||
+           is_dir_file(base, "info", "sparse-checkout"))
                return; /* keep this in $GIT_DIR */
        for (p = common_list; *p; p++) {
                const char *path = *p;