git: a1097094c4c5 - main - newvers: Set explicit git revision length

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Fri, 13 Dec 2024 13:06:37 UTC
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=a1097094c4c5d810287aca092f4ab5f9f86a426a

commit a1097094c4c5d810287aca092f4ab5f9f86a426a
Author:     Pat Maddox <pat@patmaddox.com>
AuthorDate: 2024-12-13 05:28:18 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-12-13 13:06:10 +0000

    newvers: Set explicit git revision length
    
    The --short flag is configurable. Setting an explicit length supports
    reproducible builds.
    
    Signed-off-by: Pat Maddox <pat@patmaddox.com>
    Reviewed by: emaste, imp
    Differential revision: https://github.com/freebsd/freebsd-src/pull/1547
---
 sys/conf/newvers.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh
index 481af5480399..6e5f0716c90d 100644
--- a/sys/conf/newvers.sh
+++ b/sys/conf/newvers.sh
@@ -255,7 +255,7 @@ if [ -n "$svnversion" ] ; then
 fi
 
 if [ -n "$git_cmd" ] ; then
-	git=$($git_cmd rev-parse --verify --short HEAD 2>/dev/null)
+	git=$($git_cmd rev-parse --verify --short=12 HEAD 2>/dev/null)
 	if [ "$($git_cmd rev-parse --is-shallow-repository)" = false ] ; then
 		git_cnt=$($git_cmd rev-list --first-parent --count HEAD 2>/dev/null)
 		if [ -n "$git_cnt" ] ; then