Repository navigation
Closed
Description
Two problems when Pitmaster works from a linked worktree handle (Pitmaster::open('/path/to/linked-worktree')):
Repository::worktrees()builds itsWorktreeManagerwith the handle's own working directory (), and the manager uses that as the main worktree path (Lines 342 to 347 in 5beb97d
public function worktrees(): array { $manager = new \Pitmaster\Worktree\WorktreeManager($this->commonDir, $this->workDir); return $manager->list(); } ). The entry markedpitmaster/src/Worktree/WorktreeManager.php
Lines 233 to 240 in 5beb97d
return new Worktree( name: null, path: $this->workDir, gitDir: $this->gitDir, branch: $branch, head: $headId, isMain: true, isDetached: $isDetached, isMaintherefore reports the linked worktree's path, so the main checkout's location is wrong and the linked one appears twice.Stashreads the identity from<gitDir>/config() and writesLine 241 in 5beb97d
$config = GitConfig::fromFile($this->gitDir . '/config'); logs/refs/stashunder<gitDir>(). In a linked worktreeLines 116 to 122 in 5beb97d
$reflog = Reflog::open($this->gitDir, 'refs/stash'); $reflog->append( $oldStash ?? ObjectId::zero($this->hashAlgo()), $stashId, $identity, $stashMessage, ); gitDiris.git/worktrees/<name>, which has no config, so stash commits are authored asPitmaster <[email protected]>and the stash reflog lands in the per-worktree directory whilerefs/stashis shared;git stash listshows nothing. The CLI passes$repo->gitDir()toStash().Lines 758 to 763 in 5beb97d
$stash = new \Pitmaster\Stash\Stash( $repo->objectDatabase(), $repo->refDatabase(), $repo->gitDir(), $repo->workDir(), );
Expected
worktrees() reports the main working tree path regardless of which handle calls it, and stash uses the common directory's config and reflog, as git does.
Metadata
Metadata
Assignees
Labels
No labels
Activity