From 5002a257ef2ebf07b478291e9b2be949fa59ae00 Mon Sep 17 00:00:00 2001
From: chrfranke <chrfranke@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Wed, 17 Jan 2024 16:17:10 +0000
Subject: [PATCH] utility.cpp: Add git commit hash to '-V' output if available.

git-svn-id: https://svn.code.sf.net/p/smartmontools/code/trunk@5592 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 smartmontools/ChangeLog   | 2 ++
 smartmontools/utility.cpp | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/smartmontools/ChangeLog b/smartmontools/ChangeLog
index f170a2fdb..6e7f21e95 100644
--- a/smartmontools/ChangeLog
+++ b/smartmontools/ChangeLog
@@ -2,6 +2,8 @@ $Id$
 
 2024-01-17  Christian Franke  <franke@computer.org>
 
+	utility.cpp: Add git commit hash to '-V' output if available.
+
 	Set version information also for builds from GH R/O mirror.
 
 	Makefile.am: Move creation of svnversion.sh to ...
diff --git a/smartmontools/utility.cpp b/smartmontools/utility.cpp
index 2318212f5..f4671936a 100644
--- a/smartmontools/utility.cpp
+++ b/smartmontools/utility.cpp
@@ -123,6 +123,9 @@ std::string format_version_info(const char * prog_name, int lines /* = 2 */)
 #endif
 #ifdef SMARTMONTOOLS_SVN_REV
     "smartmontools SVN rev " SMARTMONTOOLS_SVN_REV
+#ifdef SMARTMONTOOLS_GIT_HASH
+      " (git " SMARTMONTOOLS_GIT_HASH ")"
+#endif
       " dated " SMARTMONTOOLS_SVN_DATE " at " SMARTMONTOOLS_SVN_TIME "\n"
 #else
     "smartmontools SVN rev is unknown\n"
-- 
GitLab