Skip to content

fix: git-summary commit count#1147

Merged
spacewander merged 2 commits intotj:mainfrom
xwjdsh:fix/git-summary-commit-count
Jun 18, 2024
Merged

fix: git-summary commit count#1147
spacewander merged 2 commits intotj:mainfrom
xwjdsh:fix/git-summary-commit-count

Conversation

@xwjdsh
Copy link
Copy Markdown
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)
...

Comment thread bin/git-summary Outdated
commit_count() {
# shellcheck disable=SC2086
git log $MERGES_ARG --oneline "$commit" | wc -l | tr -d ' '
git rev-list --count "$commit"
Copy link
Copy Markdown
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
Copy Markdown
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
@spacewander
Copy link
Copy Markdown
Collaborator

Merged. Thanks!

@xwjdsh xwjdsh deleted the fix/git-summary-commit-count branch June 18, 2024 06:27
Copy link
Copy Markdown
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