Repository navigation
fix(git): retry force pushes as force pushes, and read git's output in English - #90
Conversation
…n English Retrying a failed push decided whether to force by searching the failure summary for "force push". The summary on failure is always "Push to '<remote>' failed", so a failed force push was retried as a plain push. Force pushes now carry their own GitOperationKind::ForcePush, the retry reads the kind, and the toolbar's pushing state covers both. Several outcomes are recognised by matching git's output: CONFLICT and "Automatic merge failed" after a pull, "could not apply" during a rebase, "Already up to date.", the SSH auth failures that trigger the HTTPS fallback, and the "[ahead N, behind M]" of %(upstream:track). A localized git translates all of them. git_command() now sets LC_MESSAGES=C. When LC_ALL is set it overrides every category, so its value moves to LANG and the per-category variables it was overriding are removed, which changes the message language and nothing else. git's stderr shown in failure toasts is English as a result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b434398fc0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let mut lc_all = None; | ||
| let mut categories = Vec::new(); | ||
| for (key, value) in vars { | ||
| if key == "LC_ALL" { |
There was a problem hiding this comment.
Match locale environment names case-insensitively on Windows
On Windows, environment-variable names are case-insensitive, but these comparisons are case-sensitive. If rgitui is launched with a mixed/lowercase variable such as lc_all=de_DE.UTF-8, Git still treats it as LC_ALL, while this function leaves it inherited; it consequently overrides the newly added LC_MESSAGES=C, so the output remains localized and the parsing failures this change intends to fix persist. Mixed-case LC_* variables likewise escape removal and can change the supposedly preserved non-message categories after LC_ALL is moved to LANG.
Useful? React with 👍 / 👎.
…tle a failed push - Windows reads environment names without regard to case, so a lowercase `lc_all` is `LC_ALL` to git there. The exact-case check missed it, `LC_MESSAGES=C` lost to it, and git kept answering in the user's language. Names now match case-insensitively where the platform does (`cfg!(windows)`), and the variable is removed under the name it was found with. - Splitting `ForcePush` from `Push` meant a plain push succeeding after a failed force push (or the reverse) no longer cleared the failure: the success handler compared kinds for equality, so the stale banner came back and still offered a retry that force-pushes. `GitOperationKind::settles` treats both pushes as one for this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…t-locale # Conflicts: # CHANGELOG.md
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Two bugs on main, found while reviewing #89. Neither depends on the i18n work.
Force-push retry
retry_git_operationdecided whether to force by checking the failure summary for"force push"(workspace/operations.rs:210). On failure the summary is always"Push to '<remote>' failed", so a failed force push was retried as a plain push, and the remote rejects that as non-fast-forward.GitOperationKind::ForcePush, chosen byGitOperationKind::push(force)in all three push entry points, including the "could not start" paths.kind.is_push(), so it covers both kinds.git's output language
Several outcomes are recognised by matching git's output, and a localized git translates every one of them:
network.rs(pull)Already up to date.,CONFLICT,Automatic merge failedrebase.rsCONFLICT,could not applyauth.rsPermission denied (publickey)and the other SSH failures that trigger the HTTPS fallbackmod.rs[ahead N, behind M]from%(upstream:track)git_command(), which every CLI call goes through, now setsLC_MESSAGES=C.LC_ALLoverrides every category, so when it is set its value moves toLANGand the per-category variables it was overriding are removed. Only the message language changes: dates, collation and character encoding resolve exactly as before, and hooks see the same locale apart from messages.Trade-off: git's stderr shown in failure toasts is now English for users with a localized git.
Verification
cargo clippy --workspace --all-targets -- -D warnings: clean.cargo test -p rgitui_git -p rgitui_workspace: 414 + 769 passed.LC_ALL,LC_ALLwith otherLC_*set, and an emptyLC_ALL.LC_ALL>LC_MESSAGES>LANG, andLANGUAGEignored when the message locale isC).🤖 Generated with Claude Code