Skip to content

Commit 82450dc

Browse files
committed
fix: return all worktrees when in root dir
1 parent e6ce73f commit 82450dc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/helpers/worktree/getWorktrees.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { executeCommand } from '#/helpers/general';
22
import { BARE_REPOSITORY } from '#/src/config/constants';
3-
import { getCurrentBranchName } from '../git';
3+
import { getCurrentBranchName, isInsideBareRepository } from '../git';
44
import { removeFirstAndLastCharacter } from '../string';
55

66
export const getWorktrees = async (
@@ -12,10 +12,12 @@ export const getWorktrees = async (
1212
try {
1313
const { stdout } = await executeCommand(command);
1414

15+
const isRootDirectory = await isInsideBareRepository();
16+
1517
const worktrees = await getFilteredWorktrees(
1618
stdout,
1719
withBareRepo,
18-
showCurrentWorktree
20+
isRootDirectory || showCurrentWorktree
1921
);
2022

2123
return worktrees;

0 commit comments

Comments
 (0)