feat: add gitObjectHashLength option to keygen-git-hash-plugin#716
Open
YutaUra wants to merge 1 commit intoreg-viz:masterfrom
Open
feat: add gitObjectHashLength option to keygen-git-hash-plugin#716YutaUra wants to merge 1 commit intoreg-viz:masterfrom
YutaUra wants to merge 1 commit intoreg-viz:masterfrom
Conversation
Author
|
Hi @Quramy, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
I added an option to
reg-keygen-git-hash-pluginto change the length of the git object ID.It is known that the default value of
objectHashLength(also referred to asabbrev) is 7.Additionally, the
getBranchHashandgetIntersectionfunctions use an 8-character abbreviated commit hash.According to a collision probability approximation based on the birthday problem,
an 8-character commit hash has about a 20% chance of collision when there are approximately 44,000 commits.
This is a realistic scenario in large-scale repositories.
References
reg-simple-keygen-plugin, but that’s not a fundamental fix. Since I encountered the same problem myself, I’ve implemented a proper fix.Screenshots
If applicable, add screenshots to help explain your changes.
What can I check for bug fixes?
Please take a look at the additional test cases. These cases demonstrate that setting objectHashLength to 3 causes a failure, while setting it to 10 works successfully. (Since it's difficult to create a case where the default value of objectHashLength —which is 7— fails, the test uses somewhat extreme values.)