Skip to content

fix(git): peel annotated tags to commit in diff#182

Open
rocketman-code wants to merge 1 commit intomainfrom
fix/issue-145
Open

fix(git): peel annotated tags to commit in diff#182
rocketman-code wants to merge 1 commit intomainfrom
fix/issue-145

Conversation

@rocketman-code
Copy link
Owner

Summary

  • chainsaw diff v1.0.0 fails when v1.0.0 is an annotated tag because resolve_ref_to_sha in src/vfs.rs returns the tag object SHA, not the commit SHA
  • Append ^{commit} to the rev-parse --verify argument so annotated tags are peeled to their underlying commit
  • This matches the peeling already done in classify_diff_arg in src/git.rs

Closes #145

Test plan

  • cargo check passes
  • cargo test passes (21/21)
  • Manual test: create an annotated tag and run chainsaw diff <tag>

When `chainsaw diff v1.0.0` is called and v1.0.0 is an annotated tag,
`resolve_ref_to_sha` returned the tag object SHA instead of the commit
SHA. `GitTreeVfs::new` then failed because it expects a commit object.

Append `^{commit}` to the rev-parse argument so annotated tags are
peeled to their underlying commit, matching the behaviour already
present in `classify_diff_arg`.

Closes #145
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.

bug(git): annotated tags cause 'not a commit' error in diff

1 participant