hooks/pre-commit: ignore deleted files
This commit is contained in:
parent
50e72a82e9
commit
065770213d
1 changed files with 1 additions and 1 deletions
|
@ -11,7 +11,7 @@ ARCH="$(uname -m)-$(uname | tr "[:upper:]" "[:lower:]")"
|
||||||
NIX_FMT="$(nix build --no-link --print-out-paths .#formatter."${ARCH}")"
|
NIX_FMT="$(nix build --no-link --print-out-paths .#formatter."${ARCH}")"
|
||||||
|
|
||||||
RESULT=0;
|
RESULT=0;
|
||||||
for file in $(git diff --name-only --cached); do
|
for file in $(git diff --diff-filter=d --name-only --cached); do
|
||||||
if grep -q "\.nix$" <<< "${file}"; then
|
if grep -q "\.nix$" <<< "${file}"; then
|
||||||
"${NIX_FMT}"/bin/nixfmt -c <<< "$(git cat-file blob :"${file}")" 2> >(sed "s|<stdin>|${file}|");
|
"${NIX_FMT}"/bin/nixfmt -c <<< "$(git cat-file blob :"${file}")" 2> >(sed "s|<stdin>|${file}|");
|
||||||
RESULT=$(( RESULT || $? ));
|
RESULT=$(( RESULT || $? ));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue