only validate each commit once #7
Reference in New Issue
Block a user
No description provided.
Delete Branch "validate-each-commit-once-only"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
validate.shchecks all the parent commits back from the HEAD commit of the current branch (for example, branch "main").But when there are merge commits and other stuff, many commits have multiple parents.
validate.shgoes backwards up all the possible commit sequences that eventually lead back to the root commit of the repository. The "graph" of all commits and their parents gets big very quickly, and common commit hashes appear many time when traversing all paths in the graph.validate.shvalidates every commit every time it finds it, which wastes a lot of time re-validating the same commits again and again.The code in this PR makes
validate.shremember commits that it has already validated, and not validate those again. It still traverses all the paths in the commit "graph", so that takes a bit of compute power, but at least it does not waste effort validating the same commit multiple times.Note: a different approach would be to just follow the commit chain of the current branch back to the root commit, and not also follow the other paths that go through old PRs etc. That would require more refactoring.
A run of this locally:
Without this change, the local run time for me is:
10 times longer
I need to do the timestamp validation thing for PRs in this repo - I will sort that out in a while.