sorenlouv / backport

A simple CLI tool that automates the process of backporting commits on a GitHub repo
https://github.com/sqren/backport/blob/main/docs/config-file-options.md
Apache License 2.0
247 stars 60 forks source link

Properly swallow errors if deleting a remote fails #505

Closed imphil closed 3 weeks ago

imphil commented 1 month ago

deleteRemote() intends to return successfully if the to-be-deleted remote does not exist. In this case, git returns an exit code of 2, and outputs a message to stderr. Depending on the locale of the user's system, this error message might be localized. spawnPromise() and spawnStream() try to set the locale to en_US, but there are no guarantees that this locale is actually available on the user's system.

Instead of doing fragile locale-dependent string parsing, simply use the exit code we get from git in this case and act on that.

Fix the mocks in the tests to behave like the real-world git, and add a test for the non-English case as well.

Fixes #507

sorenlouv commented 3 weeks ago

Released in 9.6.0