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: git-summary commit count #1147

Merged
merged 2 commits into from
Jun 18, 2024
Merged

Conversation

xwjdsh
Copy link
Contributor

@xwjdsh xwjdsh commented Jun 14, 2024

If the user has set log.showSignature = ture in gitconfig file, then the commits field in the git-summary result is wrong. Replace git log with git rev-list to avoid the problem, git rev-list isn't affected by log.* config parameters, which is also the same as git-count command.


The result of git log --oneline HEAD is as follows, then | wc -l | tr -d ' ' get wrong count.

e34dea9 (origin/main, origin/HEAD) gpg: Signature made Fri May  3 15:52:28 2024 JST
gpg:                using RSA key B5690EEEBB952194
gpg: Can't check signature: No public key
tests: update dependencies (#1142)
3bac05e gpg: Signature made Mon Apr 29 10:59:50 2024 JST
gpg:                using RSA key B5690EEEBB952194
gpg: Can't check signature: No public key
chore(deps): bump masesgroup/retrieve-changed-files from 2 to 3 (#1144)
...

bin/git-summary Outdated
@@ -77,7 +77,7 @@ active_days() {
#
commit_count() {
# shellcheck disable=SC2086
git log $MERGES_ARG --oneline "$commit" | wc -l | tr -d ' '
git rev-list --count "$commit"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We pass --no-merges via $MERGES_ARG. How could we handle this with rev-list?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed it, updated.

@spacewander spacewander merged commit b766a65 into tj:main Jun 18, 2024
5 checks passed
@spacewander
Copy link
Collaborator

Merged. Thanks!

@xwjdsh xwjdsh deleted the fix/git-summary-commit-count branch June 18, 2024 06:27
Copy link
Collaborator

@hyperupcall hyperupcall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.

3 participants