You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, my understanding is that this is to do with ambiguity- if there is another hash with the same prefix in that repository, it will be extended to be long enough to disambiguate. I haven’t confirmed this, as I haven’t seen this situation myself.
Are the versions of git different in the two machines? Is there a difference in the way it is checked out? What happens if you do gif describe on a full local checkout that has all branches?
Is there a reason you’d like the hash to be a specific length?
The issue could be that the hash is ambiguous, but I do not think this is the case. The commit number reachable from HEAD is just 1 (see output of rev-list). Of course, there could be dangling commits or other unreachable objects after a history rewrite causing the short hash to be extended to 8 chars.
My CI executes absolute-version on potentially multiple servers (each a GitHub runner) during a build. One such step would be to determine a docker image tag. Another to trigger the deployment for the current HEAD commit (referring to the docker image tag) if can-i-deploy succeeds.
If the image tag is determined as 12345678-main.12345678, but the deployment is triggered for 1234567-main.1234567 this will cause the deployment to fail because the image does not exist. So all involved machines would need to agree on the hash prefix length.
A workaround that seems to work is sudo git config --system core.abbrev 7. This config setting also applies to the git-describe called by the npm package.
I have this strange situation where
git describe --always
(as invoked by git-describe from npm) returns 8 instead of 7 characters.The issue appears to be dependent on the machine, it's not consistent but happens sometimes:
Machine 1:
Machines 2:
I can get the has down to 7 chars by passing
--abbrev-7
. It seems as if git-describe (from npm) supports that flag:It would be very beneficial for this situation to hard-code the hash to 7 characters.
The text was updated successfully, but these errors were encountered: