X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-ls-files.c;h=c9a03e5427bbf1390aeefb9d48b4e362ca6a8e1b;hb=6f53c3b21e3899716caccc2f88a1186ca7fa0f60;hp=2312866605c4140ac4e5a9f5bb963ca5ab5c6da3;hpb=e16a4779b3213f5f734da38a414ec06882400742;p=git.git diff --git a/builtin-ls-files.c b/builtin-ls-files.c index 231286660..c9a03e542 100644 --- a/builtin-ls-files.c +++ b/builtin-ls-files.c @@ -161,12 +161,7 @@ static void show_files(struct dir_struct *dir, const char *prefix) /* For cached/deleted files we don't need to even do the readdir */ if (show_others || show_killed) { - const char *path = ".", *base = ""; - int baselen = prefix_len; - - if (baselen) - path = base = prefix; - read_directory(dir, path, base, baselen, pathspec); + fill_directory(dir, pathspec); if (show_others) show_other_files(dir); if (show_killed) @@ -176,8 +171,8 @@ static void show_files(struct dir_struct *dir, const char *prefix) for (i = 0; i < active_nr; i++) { struct cache_entry *ce = active_cache[i]; int dtype = ce_to_dtype(ce); - if (excluded(dir, ce->name, &dtype) != - !!(dir->flags & DIR_SHOW_IGNORED)) + if (dir->flags & DIR_SHOW_IGNORED && + !excluded(dir, ce->name, &dtype)) continue; if (show_unmerged && !ce_stage(ce)) continue; @@ -192,8 +187,8 @@ static void show_files(struct dir_struct *dir, const char *prefix) struct stat st; int err; int dtype = ce_to_dtype(ce); - if (excluded(dir, ce->name, &dtype) != - !!(dir->flags & DIR_SHOW_IGNORED)) + if (dir->flags & DIR_SHOW_IGNORED && + !excluded(dir, ce->name, &dtype)) continue; if (ce->ce_flags & CE_UPDATE) continue; @@ -529,11 +524,8 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix) ps_matched = xcalloc(1, num); } - if ((dir.flags & DIR_SHOW_IGNORED) && !exc_given) { - fprintf(stderr, "%s: --ignored needs some exclude pattern\n", - argv[0]); - exit(1); - } + if ((dir.flags & DIR_SHOW_IGNORED) && !exc_given) + die("ls-files --ignored needs some exclude pattern"); /* With no flags, we default to showing the cached files */ if (!(show_stage | show_deleted | show_others | show_unmerged |