fix: honor Settings > Git > Default Branch, stop hardcoding "main" - #148
Merged
Conversation
added 3 commits
August 10, 2026 12:58
…#136) git_branches, git_branch_merged, and git_branch_top_authors hardcoded a "main"/"master"/origin/main/origin/master fallback chain that ended in the literal "main" even when nothing verified, so repos whose mainline was e.g. "develop"/"trunk" hit a recurring `fatal: failed to find 'main'` notification. The Default Branch setting was also never wired to any backend command. Thread the configured default branch through to all three commands (tried first, before the existing chain), and replace the hardcoded "main" fallback with the current branch, which always resolves in a non-empty repo. Shared the fallback logic in a new `resolve_default_branch()` helper (git/cmd.rs) used by both ops.rs and read.rs, mirrored it in dev-server.mjs, and updated backend.ts + every Vue call site to pass `settings.defaultBranch` through. disabled
# Conflicts: # CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_main_branch_name()(ops.rs) and a separately-implemented fallback ingit_branch_merged(read.rs) both ended in a hardcoded"main"literal when nothing verified, causinggit branch --format=...%(ahead-behind:main)/git branch --merged mainto fail withfatal: failed to find 'main'on repos whose mainline is e.g.develop/trunk.useSettings.ts/SettingsPanel.vuebut was never passed to any backend command — purely cosmetic.resolve_default_branch()insrc/git/cmd.rs(used by bothops.rsandread.rs): configured setting → remoteorigin/HEADsymref →main/master/origin/main/origin/master→ current branch (always resolves in a non-empty repo, replacing the old hardcoded literal). Mirrored indev-server.mjsforpnpm dev:webparity.git_branches,git_branch_merged,git_branch_top_authorsnow take an optionaldefault_branchparam, threaded fromsettings.defaultBranchthroughbackend.tsto every call site.execSync+shell: truegit-branches route to shell injection — switched tospawnSyncwith a discrete args array (no shell), per AGENTS.md's anti-injection rule.Test plan
resolve_default_branch(5) using a real temp repo whose only branch istrunkops.rs/read.rs(5) against real temp repos, including the exactfatal: failed to find 'main'regression and a configured-branch-wins casecargo test --lib: 176/176 passpnpm test:parity: 15/15 passvue-tsc --noEmit: no new errorsFixes #136