fix(git): force the default git locale on methods relying on parsing the output #1012
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This change ensure that methods relying on localized
git
output parsing use the default locale instead of the one defined by the user.Currently, there was only on,
git.get_tags()
when no commit exists. This PR ensure the command is run with the defaultC
locale (meaning no locale). Currently, it was failing to handle this case on non-english system and producing 2 test failures on non-english system.Checklist
./scripts/format
and./scripts/test
locally to ensure this change passes linter check and testExpected behavior
Command output parsing works whatever the user locale.
Test runs and succeed whatever the user locale.
Steps to Test This Pull Request
Define your environment locale (
LANG
/LANGUAGE
/LC_ALL
depending on the OS, shell ...) to anything else thanen_*
locale orC
locale and then:cz changelog
command on a repository without commits: it should succeedAdditional context
I choose to set the environment variables only on the command relying on localized output parsing. Benefit: any other call is localized and user can read potential failures in its own language. Drawback: devs should think about localization and forcing locale each time they want to parse a localized output.
Potential alternatives:
git
calls to run ingit
default locale