дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-06 01:57:13 +02:00
Linked worktrees share one repository's branches, but the branch popup and the Git Log Branches pane listed each checkout as its own repository. vcs_roots now reports each root's branch_root (the main worktree of its common Git directory), and both views group checkouts by it while the Paths filter still scopes the log to the selected checkout. The branch menus also offer New Worktree from '<branch>'…, which preselects the branch, requires a new branch when it is already checked out, and opens the worktree in a new window. Co-authored-by: faysou <[email protected]>
30 рядки
1.1 KiB
TypeScript
30 рядки
1.1 KiB
TypeScript
import { executeAction } from "@/platform/actions";
|
|
import { t } from "@/platform/i18n";
|
|
import { call, commands, isCancelled } from "@/platform/ipc";
|
|
import { useRemote } from "@/platform/remote";
|
|
import { notifications } from "@/workbench/contributions";
|
|
|
|
/**
|
|
* Opens worktree `path` in a new window. In an SSH or WSL session the path is on that
|
|
* machine, so the window connects there instead of opening it as a local folder.
|
|
*/
|
|
export async function openWorktree(path: string, newWindow = false): Promise<void> {
|
|
const target = useRemote.getState().session?.target;
|
|
if (target?.kind !== "ssh" && target?.kind !== "wsl") {
|
|
await executeAction("file.openProjectPath", newWindow ? { path, newWindow } : path);
|
|
return;
|
|
}
|
|
try {
|
|
await call(commands.windowOpenRemote(target, path, true));
|
|
} catch (error) {
|
|
if (isCancelled(error)) return;
|
|
notifications().notify({
|
|
level: "error",
|
|
group: "vcs",
|
|
userInitiated: true,
|
|
title: t("app.window.openFailed", { name: path }),
|
|
body: error instanceof Error ? error.message : String(error),
|
|
});
|
|
}
|
|
}
|