Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: broken annotated commit detection #183

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nickajacks1
Copy link

Annotated commits have their own object hash in addition to the commit hash. gitRepo.Tag() returns the hash of the tag instead of the commit. If this resulting hash is passed to CommitsBetween, as is done in chglog add, the hash will never be found. Update GitHashFotTag to return the commit hash if the tag is an annotated tag.

This fixes an issue where chglog add adds the entire git history when annotated tags are used.

@nickajacks1
Copy link
Author

Removed files accidentally added to branch

@caarlos0
Copy link
Member

caarlos0 commented Jan 9, 2025

do we need all these example hook files?

thanks for the PR btw :)

Annotated commits have their own object hash in addition to the commit
hash. gitRepo.Tag() returns the hash of the tag instead of the commit.
If this resulting hash is passed to CommitsBetween, as is done in
`chglog add`, the hash will never be found. Update GitHashFotTag to
return the commit hash if the tag is an annotated tag.

This fixes an issue where `chglog add` adds the entire git history when
annotated tags are used.
@nickajacks1
Copy link
Author

Probably not. I just based it off what was already there. Removed the files. Thanks for looking at this!

Copy link

codecov bot commented Jan 9, 2025

Codecov Report

Attention: Patch coverage is 70.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 26.40%. Comparing base (8211a70) to head (06cc0e7).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
git.go 70.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #183      +/-   ##
==========================================
+ Coverage   25.23%   26.40%   +1.17%     
==========================================
  Files          15       15              
  Lines         650      659       +9     
==========================================
+ Hits          164      174      +10     
+ Misses        464      462       -2     
- Partials       22       23       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants