дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 03:05:40 +02:00
fix(vcs): Route a nested repository's own entry to the enclosing one and harden multi-root
Review fixes for several repositories in one project: - A path equal to a nested repository's root (a submodule's entry, an untracked clone) belongs to the enclosing repository, in the backend and the Commit view. It was routed to the nested repository as ".", so Rollback ran `git restore` and `git clean` over the whole submodule and Commit staged everything in it. - Repository-scoped commands take the repository root exactly and fail when it is gone instead of running in an enclosing repository; path-based ones resolve the file's repository (Project::with_repo_of). - The rescan on a repository appearing or going watches `.git/HEAD`: the watcher never reports a `.git` path itself, so the old check never fired. - Status skips a repository that cannot be read; refresh falls back to the primary repository when the selected one is gone instead of failing every time. - Commit and Compare-with-Local diffs resolve repository-relative paths against the selected repository's root, not the project root. - Update Project and Fetch go on after a failing repository and report the failures together; Update skips repositories with a detached HEAD or no upstream. - The Push dialog leaves out a repository that cannot be read. - Shelve and patches fail clearly for changes of a nested repository instead of leaving them out silently (they still support the main repository only). - Fix the repository discovery test on Windows (path separators); Chinese text for the new strings.
Цей коміт міститься в:
1 джерело
c868ec8b68
коміт
b8f422d451
11 files changed
+211
-68
No files matched your search
@@ -4,7 +4,8 @@ import { call, commands } from "@/platform/ipc";
|
||||
import { editorService, type EditorInput } from "@/workbench/contributions";
|
||||
import { baseName, effectiveKind } from "./model";
|
||||
import { readWorkingText } from "./ops";
|
||||
import { statusOf, useVcs } from "./store";
|
||||
import { renamedFromPath } from "./changes";
|
||||
import { currentRepoRoot, statusOf } from "./store";
|
||||
|
||||
export type DiffSide =
|
||||
/** File content at a git revision (`HEAD`, `:0` = index, a commit id, `<id>^`). */
|
||||
@@ -104,15 +105,16 @@ export function workingDiffData(path: string, line?: number): DiffData {
|
||||
kind === "untracked" || kind === "added"
|
||||
? { type: "text", text: "", label: "(does not exist)" }
|
||||
: st?.renamedFrom
|
||||
? { type: "rev", rev: "HEAD", path: joinRoot(st.renamedFrom), label: `HEAD (${st.renamedFrom})` }
|
||||
? { type: "rev", rev: "HEAD", path: renamedFromPath(st) ?? undefined, label: `HEAD (${st.renamedFrom})` }
|
||||
: { type: "rev", rev: "HEAD" };
|
||||
const right: DiffSide =
|
||||
kind === "deleted" ? { type: "text", text: "", label: "(deleted)" } : { type: "worktree" };
|
||||
return { path, left, right, line };
|
||||
}
|
||||
|
||||
/** A path of the selected repository's log (repository-relative) made absolute. */
|
||||
function joinRoot(rel: string): string {
|
||||
const root = useVcs.getState().root;
|
||||
const root = currentRepoRoot();
|
||||
return root ? `${root}/${rel}` : rel;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Заблокувати користувача