dir.c: make 'git-status --ignored' work within leading directories
[gitweb.git] / dir.c
diff --git a/dir.c b/dir.c
index fecb6da0aef1fea403d78ed0fcff83f5dbc569cd..fd4aeae3e7aeeceda50b16f6707ac77d12d96ffb 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -1447,12 +1447,14 @@ static int treat_leading_path(struct dir_struct *dir,
        struct strbuf sb = STRBUF_INIT;
        int baselen, rc = 0;
        const char *cp;
+       int old_flags = dir->flags;
 
        while (len && path[len - 1] == '/')
                len--;
        if (!len)
                return 1;
        baselen = 0;
+       dir->flags &= ~DIR_SHOW_OTHER_DIRECTORIES;
        while (1) {
                cp = path + baselen + !!baselen;
                cp = memchr(cp, '/', path + len - cp);
@@ -1475,6 +1477,7 @@ static int treat_leading_path(struct dir_struct *dir,
                }
        }
        strbuf_release(&sb);
+       dir->flags = old_flags;
        return rc;
 }