fix(vcs): resolve shelf files against their owning repository (#919)

Root cause: shelved file paths are relative to the repository they were shelved from, but Compare with Local, Show Diff, navigation and Unshelve joined them to the selected VCS root. In a project folder that is not itself a repository (or holds several), the local file was not found and Compare with Local stayed disabled. Shelves now record their repository (older shelves fall back to the primary repository), imported patches record the current one, and every shelf action resolves paths against it, with Windows separators handled. Stash and Apply Patch already kept their repository.

Fixes #875

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Цей коміт міститься в:
l0ng-aiтаClaude Opus 5.5 authored and GitHub committed 2026-11-03 07:52:55 +08:00
1 джерело 7af2b098cc
коміт d9929bbe44
15 files changed
+327 -44

No files matched your search

+2 -1
Переглянути файл
@@ -6,6 +6,7 @@ import { baseName, effectiveKind } from "./model";
import { readWorkingText } from "./ops";
import { renamedFromPath } from "./changes";
import { currentRepoRoot, statusOf } from "./store";
import { repositoryPath } from "./repositoryPaths";
export type DiffSide =
/** File content at a git revision (`HEAD`, `:0` = index, a commit id, `<id>^`). */
@@ -144,7 +145,7 @@ export function workingDiffData(path: string, line?: number): DiffData {
/** A path of the selected repository's log (repository-relative) made absolute. */
function joinRoot(rel: string, root = currentRepoRoot()): string {
return root ? `${root}/${rel}` : rel;
return repositoryPath(root, rel);
}
/** Diff of one file changed by `commit` (first parent ↔ commit). */