From: Jeff King Date: Thu, 15 Nov 2007 07:04:30 +0000 (-0500) Subject: git-ls-files: add --exclude-standard X-Git-Tag: v1.5.4-rc0~199 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8e7b07c8a776c401ff5c4adb593f423a754d198c;p=git.git git-ls-files: add --exclude-standard This provides a way for scripts to get at the new standard exclude function. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- diff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt index 9e454f0a4..2ec0c0d27 100644 --- a/Documentation/git-ls-files.txt +++ b/Documentation/git-ls-files.txt @@ -15,6 +15,7 @@ SYNOPSIS [-x |--exclude=] [-X |--exclude-from=] [--exclude-per-directory=] + [--exclude-standard] [--error-unmatch] [--with-tree=] [--full-name] [--abbrev] [--] []\* @@ -77,6 +78,10 @@ OPTIONS read additional exclude patterns that apply only to the directory and its subdirectories in . +--exclude-standard:: + Add the standard git exclusions: .git/info/exclude, .gitignore + in each directory, and the user's global exclusion file. + --error-unmatch:: If any does not appear in the index, treat this as an error (return 1). diff --git a/builtin-ls-files.c b/builtin-ls-files.c index e0b856f43..7f6070983 100644 --- a/builtin-ls-files.c +++ b/builtin-ls-files.c @@ -387,8 +387,8 @@ static void overlay_tree(const char *tree_name, const char *prefix) static const char ls_files_usage[] = "git-ls-files [-z] [-t] [-v] (--[cached|deleted|others|stage|unmerged|killed|modified])* " "[ --ignored ] [--exclude=] [--exclude-from=] " - "[ --exclude-per-directory= ] [--full-name] [--abbrev] " - "[--] []*"; + "[ --exclude-per-directory= ] [--exclude-standard] " + "[--full-name] [--abbrev] [--] []*"; int cmd_ls_files(int argc, const char **argv, const char *prefix) { @@ -496,6 +496,11 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix) dir.exclude_per_dir = arg + 24; continue; } + if (!strcmp(arg, "--exclude-standard")) { + exc_given = 1; + setup_standard_excludes(&dir); + continue; + } if (!strcmp(arg, "--full-name")) { prefix_offset = 0; continue; diff --git a/git-add--interactive.perl b/git-add--interactive.perl index ac598f88e..0317ad912 100755 --- a/git-add--interactive.perl +++ b/git-add--interactive.perl @@ -37,10 +37,7 @@ sub list_untracked { chomp $_; $_; } - run_cmd_pipe(qw(git ls-files --others - --exclude-per-directory=.gitignore), - "--exclude-from=$GIT_DIR/info/exclude", - '--', @_); + run_cmd_pipe(qw(git ls-files --others --exclude-standard --), @_); } my $status_fmt = '%12s %12s %s';