Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): new worktree base no longer sticks to an unborn branch while a project clones #35103

Closedjuliusmarmingewants to merge 4 commits intomain fromrefs/pull/35103/headopened View on GitHub

Showing 3 changed files with 72 additions and 8 deletions.

x
0 of 3 viewed, 3 left
33 additions and 0 deletionsapps/web/src/components/BranchToolbar.logic.test.tsModified
View file
@@ -10,6 +10,7 @@
resolveBranchToolbarPrBranch,
resolveLocalCheckoutBranchMismatch,
resolveLockedWorkspaceLabel,
+ resolveWorktreeBaseBranchSeed,
sanitizeNewRefName,
shouldIncludeBranchPickerItem,
} from "./BranchToolbar.logic";
@@ -255,6 +256,38 @@
});
});
​
+describe("resolveWorktreeBaseBranchSeed", () => {
+ const ref = (name: string, flags: { current?: boolean; isDefault?: boolean }): VcsRef => ({
+ name,
+ current: flags.current ?? false,
+ isDefault: flags.isDefault ?? false,
+ worktreePath: null,
+ });
+ const seed = (
+ refs: ReadonlyArray<VcsRef>,
+ activeThreadBranch: string | null = null,
+ activeThreadBranchListed: boolean | null = null,
+ ) => resolveWorktreeBaseBranchSeed({ activeThreadBranch, activeThreadBranchListed, refs });
+​
+ it("prefers the default branch, then the current listed branch", () => {
+ expect(seed([ref("feature", { current: true }), ref("staging", { isDefault: true })])).toBe(
+ "staging",
+ );