Skip to content

refactor(vcs): back GitRepository with LibGit2Sharp#367

Closed
ChrisonSimtian wants to merge 1 commit into
mainfrom
refactor/352-libgit2sharp
Closed

refactor(vcs): back GitRepository with LibGit2Sharp#367
ChrisonSimtian wants to merge 1 commit into
mainfrom
refactor/352-libgit2sharp

Conversation

@ChrisonSimtian

Copy link
Copy Markdown
Collaborator

What

  • Replace the hand-rolled .git/config, HEAD and packed-refs parsing in GitRepository.FromLocalDirectory with LibGit2Sharp introspection (head, commit, branch, tags, tracked remote/branch, remote URL).
  • Replace the remote-URL regex with Uri-based parsing, plus a small SCP-like (git@host:path) fallback for the syntax Uri cannot represent.
  • Add LibGit2Sharp 0.31.0 to Directory.Packages.props and reference it from Fallout.Build.

Why

  • The old code parsed git on-disk internals by hand. It breaks whenever git changes its storage format. LibGit2Sharp is the standard binding and removes the fragile parsing + URL regex.
  • Public GitRepository surface is unchanged. This is an internal swap, non-breaking, targeting the 2026 line.

Tests

  • GitRepositoryTest green: 26 passed (was 22), added SSH-with-port, HTTP, file:// and UNC (\server\share\repo.git) remote cases.
  • dotnet build fallout.slnx succeeds, 0 errors.

Note on base branch

The task asked to base this on spike/shim-migration-redesign. This worktree was actually forked from main (b4866d92), which still uses the src/Fallout.Build/ layout, whereas spike/shim-migration-redesign has already renamed the project to src/Fallout.Application/ (onion re-layout). Basing against the spike branch would produce a huge spurious diff and land the edit on a path that no longer exists there, so this PR targets main where the change applies cleanly. Re-target if the spike branch is the intended integration point.

Closes #352

- Replace hand-rolled .git/config, HEAD and packed-refs parsing in
  FromLocalDirectory with LibGit2Sharp introspection
- Replace the remote-URL regex with Uri-based parsing plus a small
  SCP-like (git@host:path) fallback
- Public GitRepository surface is unchanged (internal swap only)
- Add SSH/HTTPS/UNC remote URL test cases

Closes #352

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ChrisonSimtian ChrisonSimtian requested a review from a team as a code owner June 3, 2026 07:51
@ChrisonSimtian ChrisonSimtian added the target/2026 Targets the 2026 calendar-version line (current). See ADR-0004. label Jun 3, 2026
@ChrisonSimtian

Copy link
Copy Markdown
Collaborator Author

Discarding. The agent worktrees forked from the pre-rearchitecture tree (main), so this is implemented against old paths (Fallout.Build/Common/Utilities) and does not stack cleanly on #359. Will redo on the new onion structure after #359 merges. Issue stays open.

@ChrisonSimtian ChrisonSimtian deleted the refactor/352-libgit2sharp branch June 3, 2026 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

target/2026 Targets the 2026 calendar-version line (current). See ADR-0004.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace GitRepository .git-internals parsing with LibGit2Sharp

1 participant