2011/4/12 Miklos Vajna <vmiklos@frugalware.org>:
On Mon, Apr 11, 2011 at 08:29:13PM +0200, Andras Timar <timar74@gmail.com> 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 <atimar@novell.com>
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
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.