summaryrefslogtreecommitdiff
path: root/git-hooks/pre-commit
diff options
context:
space:
mode:
authorLex Neva <lexelby@users.noreply.github.com>2018-03-01 20:06:45 -0500
committerGitHub <noreply@github.com>2018-03-01 20:06:45 -0500
commit1e337bc9052be40e7ad0da62761b3256542f15d0 (patch)
tree1e23548f4770754c63c25435a824b4e9aeed8ea4 /git-hooks/pre-commit
parent2ddc013c760a8b4be32606e8aa8334f4e17b5c68 (diff)
don't commit messages.po if only POT-Creation-Date changed (#114)
Diffstat (limited to 'git-hooks/pre-commit')
-rwxr-xr-xgit-hooks/pre-commit14
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