Skip to content

Commit d5ba4d8

Browse files
committed
fix: explicitly set core.abbrev=8 while getting hash
The core.abbrev configuration in git allows the user to set the short hash to a different length. This is common to do for a lot of developers in large projects such as the Linux Kernel where a longer short hash is desired due to the number of commits. Currently, if the user has this configuration set, the build will fail if -Werror=overflow is set due to the larger value given by `git rev-parse`. Fix the issue by explicitly setting core.abbrev=8 when running rev-parse. Signed-off-by: Gary Kim <[email protected]>
1 parent cb8b771 commit d5ba4d8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rev.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import subprocess
22

33
def get_git_specifier():
4-
rev_stat = subprocess.run(['git rev-parse --short HEAD --'], shell=True, capture_output=True)
4+
rev_stat = subprocess.run(['git -c core.abbrev=8 rev-parse --short HEAD --'], shell=True, capture_output=True)
55
if rev_stat.returncode != 0:
66
print("Error describing git revision.")
77
exit(-1)

0 commit comments

Comments
 (0)