diff options
-rw-r--r-- | .gitattributes | 1 | ||||
-rwxr-xr-x | g | 6 | ||||
-rwxr-xr-x | git-hooks/pre-commit | 10 |
3 files changed, 10 insertions, 7 deletions
diff --git a/.gitattributes b/.gitattributes index d414da85d0db..416fa8c63b14 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,2 @@ *.doc binary *.sdw binary -*.po filter=po @@ -38,12 +38,6 @@ function update_hooks() if [ "$PWD" != "$RAWBUILDDIR" -a ! -e .gitattributes ]; then ln -s $RAWBUILDDIR/.gitattributes . fi - if [ -z "$(git config filter.po.clean)" ] ; then - git config filter.po.clean 'msgcat - --no-wrap' - fi - if [ -z "$(git config filter.po.smudge)" ] ; then - git config filter.po.smudge cat - fi } # extra params for some commands, like log diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit index 4f3809ab9713..7d69f4debb2f 100755 --- a/git-hooks/pre-commit +++ b/git-hooks/pre-commit @@ -151,6 +151,16 @@ while (my $file = <FILES>) { } } +# run 'msgcat --nowrap' when committing *.po files +open(FILES, "git diff-index --cached --name-only $against |") || die "Cannot run git diff-index."; +while (my $file = <FILES>) { + chomp($file); + if ($file =~ /\.po$/) { + system("msgcat --no-wrap $file > $file.KQnBbK6wQE;mv $file.KQnBbK6wQE $file;"); + system("git add $file"); + } +} + # be strict about tabs - we don't want them at all, setup your editor # correctly ;-) my $err_ext = ""; |