Skip to content

fix(mr create): support non-english languages

Jay McCure requested to merge jmc-7402 into main

Description

In #7402 (closed) and #683 (closed), glab mr create is failing due to the user having their language set to German and French respectively.

This is is because glab uses git remote show <remote> to get the default branch information, and it relies on HEAD branch: being present, whereas in German it is Hauptbranch: for example. This change means that the associated git command (and only this command) will be run with the LC_ALL env variable

LC_ALL=C was used as C defaults to english and LC_ALL will override local language settings. https://www.ibm.com/support/pages/what-lcall-variable#:~:text=It%20is%20a%20convenient%20way,specifies%20the%20ANSI%20C%20locale / https://man7.org/linux/man-pages/man7/locale.7.html

Note: The git output is not displayed to the user.

Related Issues

Resolves #7402 (closed)

How has this been tested?

The bug can be recreated by running: LANG=de_DE.UTF-8 glab mr create

In our unit tests we stub the git output so I couldn't add a test for this.

Screenshots (if appropriate):

Before (no default branch found): Screenshot_2023-10-30_at_17.20.52

After: Screenshot_2023-10-30_at_16.04.17

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation
  • Chore (Related to CI or Packaging to platforms)
  • Test gap
Edited by Jay McCure

Merge request reports