From: Junio C Hamano Date: Mon, 16 Nov 2009 07:07:32 +0000 (-0800) Subject: Merge branch 'jk/maint-1.6.3-ls-files-i' into maint X-Git-Tag: v1.6.5.3~7 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/958742ba43a0e3847cc7095869f0d96febe47132?ds=inline;hp=-c Merge branch 'jk/maint-1.6.3-ls-files-i' into maint * jk/maint-1.6.3-ls-files-i: ls-files: unbreak "ls-files -i" --- 958742ba43a0e3847cc7095869f0d96febe47132 diff --combined Documentation/git-ls-files.txt index 021066e95d,89859153f3..625723e41f --- a/Documentation/git-ls-files.txt +++ b/Documentation/git-ls-files.txt @@@ -44,12 -44,14 +44,14 @@@ OPTION -o:: --others:: - Show other files in the output + Show other (i.e. untracked) files in the output -i:: --ignored:: - Show ignored files in the output. - Note that this also reverses any exclude list present. + Show only ignored files in the output. When showing files in the + index, print only those matched by an exclude pattern. When + showing "other" files, show only those matched by an exclude + pattern. -s:: --stage:: diff --combined builtin-ls-files.c index c5c0407b0b,e458a491c7..c9a03e5427 --- a/builtin-ls-files.c +++ b/builtin-ls-files.c @@@ -161,7 -161,12 +161,7 @@@ static void show_files(struct dir_struc /* 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) @@@ -170,6 -175,10 +170,10 @@@ if (show_cached | show_stage) { for (i = 0; i < active_nr; i++) { struct cache_entry *ce = active_cache[i]; + int dtype = ce_to_dtype(ce); + if (dir->flags & DIR_SHOW_IGNORED && + !excluded(dir, ce->name, &dtype)) + continue; if (show_unmerged && !ce_stage(ce)) continue; if (ce->ce_flags & CE_UPDATE) @@@ -182,6 -191,10 +186,10 @@@ struct cache_entry *ce = active_cache[i]; struct stat st; int err; + int dtype = ce_to_dtype(ce); + if (dir->flags & DIR_SHOW_IGNORED && + !excluded(dir, ce->name, &dtype)) + continue; if (ce->ce_flags & CE_UPDATE) continue; err = lstat(ce->name, &st); @@@ -441,7 -454,7 +449,7 @@@ int cmd_ls_files(int argc, const char * OPT_BIT(0, "directory", &dir.flags, "show 'other' directories' name only", DIR_SHOW_OTHER_DIRECTORIES), - OPT_BIT(0, "no-empty-directory", &dir.flags, + OPT_NEGBIT(0, "empty-directory", &dir.flags, "don't show empty directories", DIR_HIDE_EMPTY_DIRECTORIES), OPT_BOOLEAN('u', "unmerged", &show_unmerged, @@@ -473,7 -486,7 +481,7 @@@ prefix_offset = strlen(prefix); git_config(git_default_config, NULL); - argc = parse_options(argc, argv, builtin_ls_files_options, + argc = parse_options(argc, argv, prefix, builtin_ls_files_options, ls_files_usage, 0); if (show_tag || show_valid_bit) { tag_cached = "H "; @@@ -516,8 -529,11 +524,8 @@@ 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 |