From b85a657fae21b52fa6eee45ae5f3ba9570165e1e Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Tue, 27 May 2014 17:22:01 +0200 Subject: fix generating a list of files/directories ignored by git "git ls-files --others --ignore --exclude-standard --directory" doesn't include the files that for example get ignored by this .gitignore line: ----- default/* ----- Without the "--directory" line it includes these files, but doesn't include: ----- folder/ ----- So combine those 2 commands. The next line (grep -xFvf) requires an exact match (-x). As a result the files in the 1st example were included in the .etckeeper file. Reference: http://stackoverflow.com/questions/466764/show-ignored-files-in-git#answer-1446609 --- pre-commit.d/30store-metadata | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pre-commit.d/30store-metadata b/pre-commit.d/30store-metadata index 9e2792f..edec06b 100755 --- a/pre-commit.d/30store-metadata +++ b/pre-commit.d/30store-metadata @@ -28,7 +28,7 @@ filter_ignore() { grep -Evf "$listfile" ;; git) - git ls-files --others --ignore --exclude-standard --directory > "$listfile" || true + (git ls-files -oi --exclude-standard; git ls-files -oi --exclude-standard --directory) | sort | uniq > "$listfile" || true sed 's/^\.\///' | grep -xFvf "$listfile" ;; esac -- cgit v1.2.3