Skip to content

Fix issue with gettext:regenerate not cleaning up locale changes

Thong Kuah requested to merge use_system_for_gettext_git_command into master

What does this MR do?

Related issue: #238208 (closed)

This fixes the problem where gitlab.po files was modified when running bin/rake gettext:regenerate even though there are no changes.

Additionally we bypass the shell by splitting the args into tokens. This has the effect of quoting 'locale/*/gitlab.po' which means that git will only match against the working tree. So as we no longer attempt to checkout a file that is unknown to git, the git error seen in #238208 (comment 407172042) is resolved.

Also raises if for any reason the git checkout command fails

Testing

To get an idea about the problem, check that the directory locale/ml_IN/ exists. If not create it with:

mkdir locale/ml_IN/

On master you will see that a range of files has changed. This is because the git checkout command failed silently (https://gitlab.com/gitlab-org/gitlab/blob/421ac63d/lib/tasks/gettext.rake#L41-41).

Edited by Thong Kuah

Merge request reports