use git hook instead of gitattributes filter for *.po files

This commit is contained in:
Andras Timar 2011-04-11 20:06:16 +02:00
parent 63e01f7408
commit 066300b5aa
3 changed files with 10 additions and 7 deletions

1
.gitattributes vendored
View file

@ -1,3 +1,2 @@
*.doc binary
*.sdw binary
*.po filter=po

6
g
View file

@ -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

View file

@ -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 = "";