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 -b to 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
switchToMaybeExistingBranch with an existing branch name
- Observe
git checkout -b being 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
Description:
The current
switchToMaybeExistingBranchmethod determines branch checkout success by parsinggit checkoutcommand's stderr output. However, since Git client messages vary by system language locale, in non-English environments (e.g., Chinese, Japanese), thestderr.includes()string matching may fail, causing:git checkout -bto recreate existing branchesfatal: a branch named 'xxx' already existsReproduction Steps:
export LANG=zh_CN.UTF-8)switchToMaybeExistingBranchwith an existing branch namegit checkout -bbeing incorrectly triggered with errorAffected Code:
https://github.com/un-ts/changesets-gitlab/blob/main/src/git-utils.ts#L37-L48
Environment: