fix handling of deleted files in pre-commit hook
This commit is contained in:
parent
fb03fe842d
commit
50434b3b0b
1 changed files with 4 additions and 3 deletions
|
@ -1,8 +1,9 @@
|
|||
#!/bin/sh
|
||||
git diff --cached --quiet -- scripts && exit 0
|
||||
git diff --name-only -- scripts | grep --fixed-strings "$(git diff --cached --name-only -- scripts)" && exit 1
|
||||
staged="$(git diff --cached --diff-filter=d --name-only -- scripts)"
|
||||
[ "$staged" ] || exit 0
|
||||
git diff --name-only -- scripts | grep --fixed-strings "$staged" && exit 1
|
||||
version="$(date --utc +%Y.%m.%d.%H%M%S)"
|
||||
git diff --cached --name-only -- scripts | while read -r file; do
|
||||
echo "$staged" | while read -r file; do
|
||||
sed --in-place "s/@version .*/@version $version/" "$file"
|
||||
git add "$file"
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue