2

I have, following this answer, created an executable file "podiff" for use as a custom diff (and later, hopefully, a filter) calling grep in this way:

grep -Ev '^#:|^"POT-Creation-Date|^"PO-Revision-Date|^"Last-Translator' $1

It dutifully seems to omit all the changes in metadata which are uninteresting when using any version control system.

Unfortunately, it would seem that in addition to a .gitattribute entry I also need an extra .gitconfig file to be manually included in .git/config to allow this behaviour to itself be version-controlled.

Can I somehow inline the podiff file into my .gitconfig file at least?

This more primitive entry works inline:

[diff "podiff"]
    textconv = "grep -Ev '^#:'"

but I have not found a way to make the full expression work.

Entering manually or via git config --add

textconv = "grep -Ev '^#:|^\"POT-Creation-Date|^\"PO-Revision-Date|^\"Last-Translator'"

results in the full diff, no lines omitted.

textconv = "grep -Ev '^#:|^\\"POT-Creation-Date|^\\"PO-Revision-Date|^\\"Last-Translator'"

results in "fatal: Invalid configuration line 2 in file .git/../.gitconfig".

X/Y answers:

This answer suggests using gettext-specific tools instead of parsing the generated file "manually". However, it would seem that msgcmp cannot omit such lines at all and msgcat can only omit specifically usage comments, not the rest. (Etc. for the other tools.)

Presumably it would be best to suppress the generation of the bothersome lines in the first place, but e.g. the MonoDevelop GetText plugin that some of my colleagues use does not offer any configuration options at all, nor does another such tool, Poedit.

Is there a better way?

(Including "just keep your hands off gettext" or "you actually can inline the .gitconfig entry into your .gitattributes and keep the podiff file instead".)

3
  • The 2nd one doesn't make much sense. The 1st one looks correct, although not sure why there's the need for single quotes, I don't see any spaces inside. Why is there -E flag e.g. in the "primitive" example but not in any of the full ones?
    – Destroy666
    Commented Jun 6 at 22:51
  • Ah. Paste error. The -E is required for braces and or. Unsure how I managed to lose it, but it definitely has to be there. Fixing... done.
    – Zsar
    Commented Jun 7 at 9:44
  • I kept the single quotes and the -E flag to minimise differences between working-but-incomplete and desired-but-not-working examples. That is, "if I add anything more, it breaks".
    – Zsar
    Commented Jun 7 at 9:46

0

You must log in to answer this question.

Browse other questions tagged .