Add configurable base branch per repo#76
Merged
Merged
Conversation
Added readBaseBranch function to TreemonConfig.fs with validation. 14 unit tests in UpstreamRemoteTests.fs ReadBaseBranchTests class.
Parameterized mainRef, fetchUpstream, tryFastForwardMain, branchSortKey in GitWorktree.fs with baseBranch parameter. Updated callers in RefreshScheduler.fs, SyncEngine.fs, WorktreeApi.fs to pass 'main' default. Added mainRef and branchSortKey tests.
Added BaseBranch field to PerRepoState + UpdateBaseBranch StateMsg in RefreshScheduler.fs. Read config via TreemonConfig.readBaseBranch during RefreshWorktreeList. Passed repo.BaseBranch to all mainRef/fetchUpstream/branchSortKey/executeSyncPipeline callers.
…s and reject leading dashes Add validBranchNamePattern that requires alphanumeric first char and allows slashes. Use it in readBaseBranch instead of validRemoteNamePattern. Add 4 tests: slash branches accepted, dash-prefixed branches rejected.
…baseBranch
Fix stale reference to hardcoded {remote}/main, add Base Branch Resolution section.
Add BaseBranch to RepoWorktrees and RepoModel types, populate from PerRepoState, and render a deploy-branch badge on the repo section header when the configured base branch differs from main.
All useful content is already in worktree-monitor.md Base Branch Resolution subsection.
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.
Problem
Every repo is hardcoded to use
mainas the base branch for ahead/behind counts, diff stats, fetch targets, fast-forward, merge/rebase in the sync pipeline, and branch sort priority. Repos that usedevordevelopas their primary branch show incorrect metrics.Changes
Add per-repo
baseBranchconfig to.treemon.json(defaults to"main"when omitted):{ "baseBranch": "dev" }Config layer (
TreemonConfig.fs):readBaseBranchreads the setting with branch-name validation (allows/for hierarchical branches, rejects leading dashes)Git operations (
GitWorktree.fs):mainRef,fetchUpstream,tryFastForwardMain,branchSortKeyall parameterized withbaseBranchinstead of hardcoded"main"State propagation (
RefreshScheduler.fs,SyncEngine.fs,WorktreeApi.fs):BaseBranchfield onPerRepoState, read from config during worktree list refreshUI badge (
App.fs,Navigation.fs,Types.fs):baseBranchdiffers from"main", a badge appears on the repo header row (reusesdeploy-branchCSS class)Spec updates (
worktree-monitor.md, newconfigurable-base-branch.md)Tests
readBaseBranchconfig reading + validation,mainRefparameterization,branchSortKeywith custom base branch