fix(worktree): refresh changed discovery metadata

This commit is contained in:
Bohdan Triapitsyn
2026-07-12 00:49:28 +03:00
parent 711289a606
commit fb173067f5
2 changed files with 27 additions and 10 deletions
@@ -153,6 +153,18 @@ describe('worktreeMapsEqual', () => {
expect(worktreeMapsEqual(a, b)).toBe(false);
});
test('returns false when head state changes without a branch change', () => {
const a = new Map([['/repo', [wt('/r/main', '', { headState: 'unborn' })]]]);
const b = new Map([['/repo', [wt('/r/main', '', { headState: 'detached' })]]]);
expect(worktreeMapsEqual(a, b)).toBe(false);
});
test('returns false when discovered display metadata changes', () => {
const a = new Map([['/repo', [wt('/r/main', '', { name: 'old', label: 'old' })]]]);
const b = new Map([['/repo', [wt('/r/main', '', { name: 'new', label: 'new' })]]]);
expect(worktreeMapsEqual(a, b)).toBe(false);
});
test('returns false when paths differ', () => {
const a = new Map([['/repo', [wt('/r/main', 'main')]]]);
const b = new Map([['/repo', [wt('/r/other', 'main')]]]);