diff options
author | Pim van den Berg <pim@nethuis.nl> | 2014-05-27 17:22:01 +0200 |
---|---|---|
committer | Pim van den Berg <pim@nethuis.nl> | 2014-05-27 17:25:23 +0200 |
commit | b85a657fae21b52fa6eee45ae5f3ba9570165e1e (patch) | |
tree | 174204b3b4d950f06459cf96fad033b1f84f1d1d /pre-commit.d/30store-metadata | |
parent | 59a522eadf8febc481b66676f3ee78cff0ccb5bb (diff) |
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
Diffstat (limited to 'pre-commit.d/30store-metadata')
-rwxr-xr-x | pre-commit.d/30store-metadata | 2 |
1 files changed, 1 insertions, 1 deletions
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 |