wp-plugin-in-github icon indicating copy to clipboard operation
wp-plugin-in-github copied to clipboard

On deploy POT will always change and be commited.

Open wedi opened this issue 12 years ago • 4 comments

The check in deploy-plugin.sh#L150 is nice but will always evaluate to true as makepot.php will change a timestamp in the POT file on every call.

Some RegEx magic is needed again to revert the file if nothing except the timestamp POT-Creation-Date: 2013-10-18 21:42:46+00:00\n" has changed.

I posted an issue and asked for a change of that behaviour at my preferred WP i18n tools variant: grappler/i18n#4 as this issue should eventually be mitigated at the source.

wedi avatar Oct 19 '13 20:10 wedi

Agreed. Let me see if I am able to come up with that magic RegEx :)

sudar avatar Oct 20 '13 04:10 sudar

It would be great if you could contribute to i18n.

grappler avatar Oct 21 '13 18:10 grappler

I have used this shell script as a pre-commit git hook. In it's current form, it needs customized to your directory structure, but won't commit the regenerated pot file if nothing changed.

#!/usr/bin/env bash

php wp-i18n-tools/makepot.php wp-plugin plugin-name plugin-folder/languages/plugin-name.pot


if  git diff-files --shortstat plugin-folder/languages/plugin-name.pot | grep "1 insertion(+), 1 deletion(-)" &> /dev/null ; then
        git checkout HEAD -- plugin-folder/languages/plugin-name.pot
    exit 0
else
    git add plugin-folder/languages/plugin-name.pot
fi

gMagicScott avatar Dec 15 '13 18:12 gMagicScott

@gMagicScott Thanks for sharing this snippet. I will try to merge with deploy-plugin.sh

sudar avatar Dec 16 '13 14:12 sudar