refactor: extract explorer open gesture and standardize icon sizes
This commit is contained in:
@@ -118,6 +118,16 @@ describe("createWorktree", () => {
|
||||
expect(ownership.repoRoot).toBe(repoDir);
|
||||
});
|
||||
|
||||
it("treats non-git directories as non-worktrees without throwing", async () => {
|
||||
const nonGitDir = join(tempDir, "not-a-repo");
|
||||
execSync(`mkdir -p ${nonGitDir}`);
|
||||
|
||||
const ownership = await isPaseoOwnedWorktreeCwd(nonGitDir, { paseoHome });
|
||||
|
||||
expect(ownership.allowed).toBe(false);
|
||||
expect(ownership.worktreePath).toBe(realpathSync(nonGitDir));
|
||||
});
|
||||
|
||||
it("creates a worktree with a new branch", async () => {
|
||||
const projectHash = await deriveWorktreeProjectHash(repoDir);
|
||||
const result = await createWorktree({
|
||||
|
||||
@@ -692,7 +692,15 @@ export async function isPaseoOwnedWorktreeCwd(
|
||||
cwd: string,
|
||||
options?: { paseoHome?: string }
|
||||
): Promise<PaseoWorktreeOwnership> {
|
||||
const gitCommonDir = await getGitCommonDir(cwd);
|
||||
let gitCommonDir: string;
|
||||
try {
|
||||
gitCommonDir = await getGitCommonDir(cwd);
|
||||
} catch {
|
||||
return {
|
||||
allowed: false,
|
||||
worktreePath: normalizePathForOwnership(cwd),
|
||||
};
|
||||
}
|
||||
const repoRoot = resolveRepoRootFromGitCommonDir(gitCommonDir);
|
||||
const worktreesRoot = await getPaseoWorktreesRoot(cwd, options?.paseoHome);
|
||||
const resolvedRoot = normalizePathForOwnership(worktreesRoot) + sep;
|
||||
|
||||
Reference in New Issue
Block a user