/*
* We are looking for ignored files and our directory is not ignored,
- * check if it contains only ignored files
+ * check if it contains untracked files (i.e. is listed as untracked)
*/
if ((dir->flags & DIR_SHOW_IGNORED) && !exclude) {
int ignored;
ignored = read_directory_recursive(dir, dirname, len, 1, simplify);
dir->flags |= DIR_SHOW_IGNORED;
- return ignored ? ignore_directory : show_directory;
+ if (ignored)
+ return ignore_directory;
}
if (!(dir->flags & DIR_HIDE_EMPTY_DIRECTORIES))
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);
}
}
strbuf_release(&sb);
+ dir->flags = old_flags;
return rc;
}