mtkennerly / dunamai

Dynamic versioning library and CLI
https://dunamai.readthedocs.io/en/latest
MIT License
320 stars 23 forks source link

Unstable sha commit length #48

Closed mutalimov95 closed 2 years ago

mutalimov95 commented 2 years ago

Sometimes when I use {commit} in format I get 8 characters length (in many cases I get 9 characters length). I don't know why this is happening and how to predict the length of the sha.

mtkennerly commented 2 years ago

Dunamai just takes the hash returned by the VCS tool (e.g., git log -n 1 --format="format:%h"), so it's up to the VCS. For example, using Git, I get 7 characters in the Dunamai repository as well as in a new repo with one commit, but I get 8 characters in a repository with over 2,000 commits, so I think it gradually increases the length to avoid collisions.

mtkennerly commented 2 years ago

The next release will provide a --full-commit option so that you can always get the full hash.