propose_translation_update: Handle .tx/config in git

Some packages have .tx/config in git. The tx commands update
.tx/config if new localization files are added to the repository.
If .tx/config changes, "git review" will fail with a
message stating that there are uncommitted files in the tree.

Take care that .tx/config is not changed and thus "git review" does not
fail.

Changes to .tx/config need to be done as part as separate changes.

Change-Id: I235877fb568c0365cc822c265d401f0cf4dfdbf5
This commit is contained in:
Andreas Jaeger 2014-03-23 21:37:09 +01:00
parent a04462b040
commit d83a2bc9d0

@ -17,10 +17,16 @@
# Initial transifex setup
function setup_translation ()
{
# Track in HAS_CONFIG whether we run "tx init" since calling it
# will add the file .tx/config - and "tx set" might update it. If
# "tx set" updates .tx/config, we need to handle the file if it
# existed before.
HAS_CONFIG=1
# Initialize the transifex client, if there's no .tx directory
if [ ! -d .tx ] ; then
tx init --host=https://www.transifex.com
HAS_CONFIG=0
fi
}
@ -78,6 +84,14 @@ EOF
# Propose patch using COMMIT_MSG
function send_patch ()
{
# Revert any changes done to .tx/config
if [ $HAS_CONFIG -eq 1 ]
then
git reset -q .tx/config
git checkout -- .tx/config
fi
# Don't send a review if nothing has changed.
if [ `git diff --cached |wc -l` -gt 0 ]
then