summaryrefslogtreecommitdiff
path: root/LGPL-2.1
diff options
context:
space:
mode:
authorKarsten Blees <karsten.blees@gmail.com>2013-04-15 19:14:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-04-15 19:34:01 (GMT)
commitdefd7c7b3717394ee05b454172bf7b1e747af6ae (patch)
treedb24588e6cf0dd0937d7f39f44ba503564cc43bb /LGPL-2.1
parent8aaf8d7728e8ac50cbf6bcad05b6e896d4e69e0b (diff)
downloadgit-defd7c7b3717394ee05b454172bf7b1e747af6ae.zip
git-defd7c7b3717394ee05b454172bf7b1e747af6ae.tar.gz
git-defd7c7b3717394ee05b454172bf7b1e747af6ae.tar.bz2
dir.c: git-status --ignored: don't scan the work tree three times
'git-status --ignored' recursively scans directories up to three times: 1. To collect untracked files. 2. To collect ignored files. 3. When collecting ignored files, to check that an untracked directory that potentially contains ignored files doesn't also contain untracked files (i.e. isn't already listed as untracked). Let's get rid of case 3 first. Currently, read_directory_recursive returns a boolean whether a directory contains the requested files or not (actually, it returns the number of files, but no caller actually needs that), and DIR_SHOW_IGNORED specifies what we're looking for. To be able to test for both untracked and ignored files in a single scan, we need to return a bit more info, and the result must be independent of the DIR_SHOW_IGNORED flag. Reuse the path_treatment enum as return value of read_directory_recursive. Split path_handled in two separate values path_excluded and path_untracked that don't change their meaning with the DIR_SHOW_IGNORED flag. We don't need an extra value path_untracked_and_excluded, as directories with both untracked and ignored files should be listed as untracked. Rename path_ignored to path_none for clarity (i.e. "don't treat that path" in contrast to "the path is ignored and should be treated according to DIR_SHOW_IGNORED"). Replace enum directory_treatment with path_treatment. That's just another enum with the same meaning, no need to translate back and forth. In treat_directory, get rid of the extra read_directory_recursive call and all the DIR_SHOW_IGNORED-specific code. In read_directory_recursive, decide whether to dir_add_name path_excluded or path_untracked paths based on the DIR_SHOW_IGNORED flag. The return value of read_directory_recursive is the maximum path_treatment of all files and sub-directories. In the check_only case, abort when we've reached the most significant value (path_untracked). Signed-off-by: Karsten Blees <blees@dcon.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'LGPL-2.1')
0 files changed, 0 insertions, 0 deletions