changesets-gitlab
changesets-gitlab copied to clipboard
Git checkout creates duplicate branches in localized environments
Description:
The current switchToMaybeExistingBranch method determines branch checkout success by parsing git checkout command's stderr output. However, since Git client messages vary by system language locale, in non-English environments (e.g., Chinese, Japanese), the stderr.includes() string matching may fail, causing:
- False triggering of
git checkout -bto recreate existing branches - Potential error:
fatal: a branch named 'xxx' already exists
Reproduction Steps:
- Set OS/Git language to non-English (e.g.,
export LANG=zh_CN.UTF-8) - Call
switchToMaybeExistingBranchwith an existing branch name - Observe
git checkout -bbeing incorrectly triggered with error
Affected Code:
https://github.com/un-ts/changesets-gitlab/blob/main/src/git-utils.ts#L37-L48
Environment:
- OS: All localization-supported systems
- Git Versions: All versions affected