Skip to content

feat: add gitObjectHashLength option to keygen-git-hash-plugin#716

Open
YutaUra wants to merge 1 commit intoreg-viz:masterfrom
YutaUra:feature/add-object-hash-length
Open

feat: add gitObjectHashLength option to keygen-git-hash-plugin#716
YutaUra wants to merge 1 commit intoreg-viz:masterfrom
YutaUra:feature/add-object-hash-length

Conversation

@YutaUra
Copy link
Copy Markdown

@YutaUra YutaUra commented Apr 11, 2025

What does this change?

I added an option to reg-keygen-git-hash-plugin to change the length of the git object ID.

It is known that the default value of objectHashLength (also referred to as abbrev) is 7.
Additionally, the getBranchHash and getIntersection functions 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

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.)

@YutaUra
Copy link
Copy Markdown
Author

YutaUra commented Jun 19, 2025

Hi @Quramy,
I know you're very busy, but I’d be grateful if you could take a look when you get a chance. Appreciate your time!

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.

1 participant