@@ -69,20 +69,25 @@ build: setup po-install
6969 2> >( tee -a $( LOGS_DIR) /build/err-$( NOW) .txt >&2 )
7070
7171
72- # push: Push changed translation files and Transifex config file to repository .
73- # First it git-adds tracked file whose changes are not limited to the
74- # POT-Creation-Date header field. Then it git-adds untracked PO files
72+ # push: Commit and push translation files and Transifex config file to repo .
73+ # First it git-adds tracked file that doesn't exclusively match changes
74+ # in POT-Creation-Date header field. Then it git-adds untracked PO files
7575# that might have been created in the update process, and the Transifex
76- # configuration. If no file changed, it does nothing.
77- # The MSG variable has a default commit message, but one can overrride it
76+ # configuration. Finally, only commit and push only if any file was
77+ # git-added (staged); otherwise, it does nothing.
78+ # The MSG variable has a default commit message, but one can override it
7879# e.g. make push MSG='my message'
7980push : MSG := 'Update translations from Transifex'
8081push :
8182 @git diff -I' ^"POT-Creation-Date: ' --numstat * .po ** /* .po \
8283 | cut -f3 | xargs -r git add
8384 @git add $(git ls-files -o --exclude-standard *.po **/*.po ) .tx/config
84- @git diff-index --quiet HEAD || git commit --allow-empty -m $(MSG )
85- @git push
85+ @if [[ $( git diff --name-only --cached) != " " ]]; then
86+ git commit -m $(MSG )
87+ git push
88+ else
89+ echo ' Nothing to commit'
90+ fi
8691
8792
8893# pull: Download translations files from Transifex, and apply line wrapping.
@@ -223,13 +228,14 @@ $(LOGS_DIR)/pospell-$(NOW)/all.txt:
223228 @cut -d: -f3- $(DESTS ) | sort -u > $@
224229
225230
226- # merge: merge translations from BRANCH (Python version currently aim of
231+ # merge: Merge translations from BRANCH (Python version currently aim of
227232# translation) into each branch listed by BUGFIXBRANCH and
228233# OLDERBRANCHES (branches of older Python versions) so that older
229- # versions of the Python Docs make at least some use the latest
230- # translations, if possible. OLDERBRANCHES has '--no-overwrite'
231- # flag so it does not overwrite translated strings, preserving history.
232- # After merging, git-push merged files (if any) to the target branch.
234+ # versions of the Python Docs try make at least some use of the latest
235+ # translations. OLDERBRANCHES has '--no-overwrite' flag so it does not
236+ # overwrite translated strings, preserving history.
237+ # After merging, only commit and push only if any file was git-added
238+ # (staged) to the target branch; otherwise, it does nothing.
233239merge : venv $(BUGFIXBRANCH ) $(OLDERBRANCHES )
234240
235241$(OLDERBRANCHES ) : OVERWRITEFLAG = --no-overwrite
@@ -242,12 +248,18 @@ $(BUGFIXBRANCH) $(OLDERBRANCHES):
242248 git checkout $@ ; \
243249 $(VENV_DIR ) /bin/pomerge $(OVERWRITEFLAG ) --to-files * .po ** /* .po; \
244250 $(VENV_DIR ) /bin/powrap --modified * .po ** /* .po; \
245- $(MAKE ) push MSG=" Merge $( BRANCH) branch into $@ " ; \
251+ git add -u; \
252+ if [[ $( git diff --name-only --cached) != " " ]]; then \
253+ git commit -m $(MSG ) ; \
254+ git push; \
255+ else \
256+ echo ' Nothing to commit' ; \
257+ fi ; \
246258 git checkout $(BRANCH ) ; \
247259 fi
248260
249261
250- # lint: Report reStrutcturedText syntax errors in the translation files
262+ # lint: Report reStructuredText syntax errors in the translation files
251263lint : venv
252264 @mkdir -p " $( LOGS_DIR) "
253265 @$(VENV_DIR ) /bin/sphinx-lint * .po ** /* .po | & \
0 commit comments