Sessions - source control providers do not need the parent/child relationship (#304830)

This commit is contained in:
Ladislau Szomoru
2026-03-25 18:07:01 +00:00
committed by GitHub
parent 3ac9e2694e
commit 19e3c145cb

View File

@@ -941,12 +941,17 @@ export class Repository implements Disposable {
this.disposables.push(new FileEventLogger(onRepositoryWorkingTreeFileChange, onRepositoryDotGitFileChange, logger));
// Parent source control
const parentRoot = repository.kind === 'submodule'
? repository.dotGit.superProjectPath
: repository.kind === 'worktree' && repository.dotGit.commonPath
? path.dirname(repository.dotGit.commonPath)
: undefined;
// Parent source control. Repositories opened in the Sessions app
// don't use the parent/child relationship and it is expected for
// a worktree repository to be opened while the main repository
// is closed.
const parentRoot = workspace.isAgentSessionsWorkspace
? undefined
: repository.kind === 'submodule'
? repository.dotGit.superProjectPath
: repository.kind === 'worktree' && repository.dotGit.commonPath
? path.dirname(repository.dotGit.commonPath)
: undefined;
const parent = parentRoot
? this.repositoryResolver.getRepository(parentRoot)?.sourceControl
: undefined;