Skip to content

fix: soft-handle unborn git HEAD on init/refresh - #64

Open
mrchatam wants to merge 1 commit into
mainfrom
fix/init-unborn-head
Open

mrchatam wants to merge 1 commit into
mainfrom
fix/init-unborn-head

Conversation

@mrchatam

Copy link
Copy Markdown
Owner

Summary

  • Map unborn HEAD (git init with no commits) to vcs.ErrNotFound in gitcli.Repo.Head
  • Soft-handle that in Refresh as a no-op (NewCommits: 0) so trace init succeeds
  • Add unit + CLI coverage for the empty-repo path

Test plan

  • CGO_ENABLED=1 go test ./internal/gitcli/ -run TestRefreshUnbornHead
  • CGO_ENABLED=1 go test ./cmd/trace/ -run 'TestInitSucceedsOnUnbornGitHead|TestInitCreatesDB'
  • Manual: git init then trace init in a fresh dir exits 0

Closes #52

Map rev-parse HEAD failures for empty repos to vcs.ErrNotFound and
treat that as a no-op Refresh so `trace init` succeeds after git init
with no commits yet.

Closes #52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

trace init hard-fails on unborn git HEAD (post-git init, pre-first-commit)

1 participant