[PR #677] [MERGED] fix(reference): read linked worktree commit provenance #2159

Closed
opened 2026-10-16 21:15:01 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/677
Author: @rudycelekli
Created: 10/6/2026
Status: ✅ Merged
Merged: 10/6/2026
Merged by: @morluto

Base: main ← Head: fix/rea-linked-worktree-provenance-20261006


📝 Commits (1)

  • f0d6db6 fix(reference): read linked worktree commit provenance

📊 Changes

2 files changed (+133 additions, -3 deletions)

View changed files

📝 src/application/ReferenceSourceVcsAdapter.ts (+39 -3)
➕ tests/boundary/filesystem/referenceSourceVcs.test.ts (+94 -0)

📄 Description

Problem

Reference-source import reports vcs.kind: unknown for a normal linked Git worktree on a branch, losing its commit provenance. Its HEAD is local to the worktree while the branch ref lives in Git's common directory.

Change

Read gitfile and commondir metadata without executing Git. Resolve the worktree's own HEAD against shared loose/packed refs; preserve detached HEAD and Git's private per-worktree ref namespaces. Do not infer dirty state.

The routing follows Git's repository layout.

Verification

Native Git creates an owned repository and a linked branch with a genuinely different commit:

before: native git rev-parse HEAD returns linked branch commit
        readReferenceSourceVcs(linked) => { kind: "unknown", head: null, dirty: null }
after:  reader => { kind: "git", head: <exact linked branch commit>, dirty: null }
  • Baseline regression fails on the linked branch.
  • npm run test:focused -- tests/boundary/filesystem/referenceSourceVcs.test.ts: passed. Also checks primary checkout, packed refs, detached linked HEAD, relative gitfile with CRLF and cancellation. The repository and worktree are temporary and cleaned through the repository fixture.
  • npm run check: all five tasks passed.
  • No contract/schema, packaging or provider changes. No Hopper/Ghidra verification was run or claimed.

AI-assisted reproduction, implementation and independent source review.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/677 **Author:** [@rudycelekli](https://github.com/rudycelekli) **Created:** 10/6/2026 **Status:** ✅ Merged **Merged:** 10/6/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/rea-linked-worktree-provenance-20261006` --- ### 📝 Commits (1) - [`f0d6db6`](https://github.com/morluto/rea/commit/f0d6db6b74673a14df5428631d21799e80277af4) fix(reference): read linked worktree commit provenance ### 📊 Changes **2 files changed** (+133 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/application/ReferenceSourceVcsAdapter.ts` (+39 -3) ➕ `tests/boundary/filesystem/referenceSourceVcs.test.ts` (+94 -0) </details> ### 📄 Description ## Problem Reference-source import reports `vcs.kind: unknown` for a normal linked Git worktree on a branch, losing its commit provenance. Its HEAD is local to the worktree while the branch ref lives in Git's common directory. ## Change Read gitfile and commondir metadata without executing Git. Resolve the worktree's own HEAD against shared loose/packed refs; preserve detached HEAD and Git's private per-worktree ref namespaces. Do not infer dirty state. The routing follows [Git's repository layout](https://git-scm.com/docs/gitrepository-layout). ## Verification Native Git creates an owned repository and a linked branch with a genuinely different commit: ```text before: native git rev-parse HEAD returns linked branch commit readReferenceSourceVcs(linked) => { kind: "unknown", head: null, dirty: null } after: reader => { kind: "git", head: <exact linked branch commit>, dirty: null } ``` - Baseline regression fails on the linked branch. - `npm run test:focused -- tests/boundary/filesystem/referenceSourceVcs.test.ts`: passed. Also checks primary checkout, packed refs, detached linked HEAD, relative gitfile with CRLF and cancellation. The repository and worktree are temporary and cleaned through the repository fixture. - `npm run check`: all five tasks passed. - No contract/schema, packaging or provider changes. No Hopper/Ghidra verification was run or claimed. AI-assisted reproduction, implementation and independent source review. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:15:01 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#2159
No description provided.