diff options
| author | Lex Neva <lexelby@users.noreply.github.com> | 2018-03-01 20:06:45 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-03-01 20:06:45 -0500 |
| commit | 1e337bc9052be40e7ad0da62761b3256542f15d0 (patch) | |
| tree | 1e23548f4770754c63c25435a824b4e9aeed8ea4 | |
| parent | 2ddc013c760a8b4be32606e8aa8334f4e17b5c68 (diff) | |
don't commit messages.po if only POT-Creation-Date changed (#114)
| -rwxr-xr-x | git-hooks/pre-commit | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit index f01b516e..99f59729 100755 --- a/git-hooks/pre-commit +++ b/git-hooks/pre-commit @@ -1,4 +1,14 @@ #!/bin/bash -make messages.po | grep -v 'is up to date\.$' -git add messages.po +make messages.po > /dev/null 2>&1 + +# This monstrosity asks how many lines changed, but it ignores changes to the +# "POT-Creation-Date" line. In other words, if all that's changed is the +# "POT-Creation-Date", don't bother adding messages.po +lines_changed=$(git -c difftool.ignorepot.cmd='diff -u -I "POT-Creation-Date" "$LOCAL" "$REMOTE"' difftool -t ignorepot -y messages.po | wc -l) + +if [ "$lines_changed" = 0 ]; then + git checkout messages.po +else + git add messages.po +fi |
