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 time-stamping to work with GPG signed commits #64

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

Conversation

shinnok
Copy link

@shinnok shinnok commented Aug 7, 2023

If HEAD is pointing to a gpg-signed commit, the result of the previous GET_CURRENT_COMMIT_TIMESTAMP expression will include GPG info, which in turn will end up in .update.timestamp for the current project. This is especially relevant if the user has configured git config log.showSignature true.

Fix this behavior by ignoring irrelevant GPG signed status with --no-show-signature.

If HEAD is pointing to a signed commit, the result of the expression
GET_CURRENT_COMMIT_TIMESTAMP will include GPG info, which in turn will
end up in .update.timestamp for the current project.
@arnetheduck
Copy link
Member

this would bump git version req to ... 2.10 I think - is there another way to avoid it (ie sed?)

@shinnok
Copy link
Author

shinnok commented Aug 8, 2023

Given my specific output scenario:

$ git log --pretty=format:%cd -n 1 --date=unix
gpg: Signature made Tue Aug  8 10:16:42 2023 EEST
gpg:                using RSA key DC57D8288951F46
gpg: Good signature from "Teodor <redacted>" [ultimate]
1691479002

Assuming that GPG output will always start with gpg: for everyone, we can gpg -v or sed it out. However, I would actually tail -n1 to get the timestamp out, do you think this is a better assumption? That the timestamp has a better chance to end up on the last line, than otherwise.

@shinnok
Copy link
Author

shinnok commented Aug 21, 2023

@arnetheduck Hi, what do you think of just grabbing the last line with tail, should I just push a change with just that, for the time being?

@arnetheduck
Copy link
Member

Hi, what do you think of just grabbing the last line with tail, should I just push a change with just that, for the time being?

I think that it's an excellent idea provided you test it with some git versions that ship with non-obsolete LTS releases of debian / ubuntu / redhat.

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.

2 participants