feature: limit the number of commits to be validated #9

Merged
phil merged 2 commits from limit-num-commits-validated into main 2025-06-02 04:10:48 +00:00
Owner

Signed-off-by: Phil Davis phil@jankaritech.com

Fixes #8

  • merge commits do not have timestamp information. They get "checked" easily without doing any external requests - they are effectively "skipped".
  • merge commits have 2 parent commits - the first points to the previous commit in the main branch (often that is another merge commit from an older PR). The second parent points to the real commit(s) chain from the PR that was merged. Those commits do have timestamp information to check.

So it would be useless to just follow the first parent commit each time back through the main branch, that will miss most of the real commits with timestamps. And following the second parent commit will not really be faster than following both parent commits, because the merge commits are "checked" quickly anyway.

So IMO the way to reduce time is to provide a way to limit how far back we check.

MAX_COMMITS_TO_CHECK defaults to 0 and in that case we treat 0 as infinity and check back through all commits to the root commit of the repo.

Set env var MAX_COMMITS_TO_CHECK to some positive integer to limit the number of commits to check.
We might want to check 10 or 20 in the CI of a PR?

Signed-off-by: Phil Davis <phil@jankaritech.com> Fixes #8 - merge commits do not have timestamp information. They get "checked" easily without doing any external requests - they are effectively "skipped". - merge commits have 2 parent commits - the first points to the previous commit in the main branch (often that is another merge commit from an older PR). The second parent points to the real commit(s) chain from the PR that was merged. Those commits do have timestamp information to check. So it would be useless to just follow the first parent commit each time back through the main branch, that will miss most of the real commits with timestamps. And following the second parent commit will not really be faster than following both parent commits, because the merge commits are "checked" quickly anyway. So IMO the way to reduce time is to provide a way to limit how far back we check. `MAX_COMMITS_TO_CHECK` defaults to `0` and in that case we treat `0` as infinity and check back through all commits to the root commit of the repo. Set env var `MAX_COMMITS_TO_CHECK` to some positive integer to limit the number of commits to check. We might want to check 10 or 20 in the CI of a PR?
phil added 1 commit 2025-05-28 05:12:37 +00:00
feature: limit the number of commits to be validated
All checks were successful
Validate Trusted Timestamps Actions Demo / Validate (push) Successful in 49s
aabd314dde
Signed-off-by: Phil Davis <phil@jankaritech.com>
artur reviewed 2025-05-28 08:13:18 +00:00
@@ -42,6 +42,7 @@ if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi
. "$DIR/timestamping"
declare -i MINVERSION=$TIMESTAMPING_VERSION
declare -i MAX_COMMITS_TO_CHECK=20
Owner

what about setting it to infinity for default, so that the original behavior does not change

what about setting it to infinity for default, so that the original behavior does not change
Author
Owner

Done 0 means "infinity" and is now the default.

Done `0` means "infinity" and is now the default.
phil marked this conversation as resolved
phil added 1 commit 2025-05-29 04:11:27 +00:00
feature: default to checking all commits
All checks were successful
Validate Trusted Timestamps Actions Demo / Validate (push) Successful in 13m47s
4437b66f67
phil requested review from artur 2025-05-29 04:21:08 +00:00
artur approved these changes 2025-05-29 07:31:48 +00:00
phil merged commit 31e44f9b70 into main 2025-06-02 04:10:48 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: JankariTechUG/GitTrustedTimestamps#9
No description provided.