2011/4/12 Miklos Vajna <[email protected]>: > On Mon, Apr 11, 2011 at 08:29:13PM +0200, Andras Timar <[email protected]> > wrote: >> Hi, >> >> Some of us experienced performance problems with the gitattributes >> filter defined for .po files. The 'clean' filter were not only run on >> commit, but also during clone/pull. This was not intended at all. >> Miklos asked about it on git mailing list, if it was a bug in git. See >> all details in this thread: >> http://marc.info/?t=130251154100001&r=1&w=2 >> >> On git list we were recommended to use hook instead of filter. Please >> review my patch. If you apply it, don't forget to remove po filter >> lines from your git config. > > Looks OK. Kendy, does it sound acceptable for you as well? > Amended patch, git add $file is necessary after the conversion. (Thanks for the hint Miklos).
Andras
From 8aaff311574aa6b57185b5f9b49e732ad3892895 Mon Sep 17 00:00:00 2001 From: Andras Timar <[email protected]> Date: Mon, 11 Apr 2011 20:06:16 +0200 Subject: [PATCH] use git hook instead of gitattributes filter for *.po files --- .gitattributes | 1 - g | 6 ------ git-hooks/pre-commit | 10 ++++++++++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.gitattributes b/.gitattributes index d414da8..416fa8c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,2 @@ *.doc binary *.sdw binary -*.po filter=po diff --git a/g b/g index 2d601b5..7fbf683 100755 --- a/g +++ b/g @@ -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 6817990..1cfa2ec 100755 --- a/git-hooks/pre-commit +++ b/git-hooks/pre-commit @@ -150,6 +150,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.new;mv $file.new $file;"); + system("git add $file"); + } +} + # be strict about tabs - we don't want them at all, setup your editor # correctly ;-) my $err_ext = ""; -- 1.7.0.4
_______________________________________________ LibreOffice mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice
