From 2d9e042ba894d97003d5f85e322a7a15d2e8d833 Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on Debian Linux)" <rob@synchro.net>
Date: Wed, 6 Mar 2024 18:12:44 -0800
Subject: [PATCH] Define GIT_DATE in git_hash.h and git_date in ver.cpp

Display the date of last git commit used in this bulid as part of git branch
and hash information. This helps to inform how up-to/out-of date the current
running build is, regardless of the build date/time.
---
 src/build/gitinfo.bat | 3 ++-
 src/sbbs3/targets.mk  | 1 +
 src/sbbs3/ver.cpp     | 3 ++-
 src/sbbs3/ver.h       | 3 ++-
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/build/gitinfo.bat b/src/build/gitinfo.bat
index 63b9bec242..588e08d6e0 100644
--- a/src/build/gitinfo.bat
+++ b/src/build/gitinfo.bat
@@ -1,4 +1,5 @@
 @git log -1 HEAD --format="#define GIT_HASH \"%%h\"" > git_hash.h
+@git log -1 HEAD --format="#define GIT_DATE \"%cd\"" '--date=format-local:%b %e %Y %H:%M' >> git_hash.h
 @echo #define GIT_BRANCH ^"| tr -d "\r\n" > git_branch.h
 @git rev-parse --abbrev-ref HEAD | tr -d "\n" >> git_branch.h
-@echo ^" >> git_branch.h
\ No newline at end of file
+@echo ^" >> git_branch.h
diff --git a/src/sbbs3/targets.mk b/src/sbbs3/targets.mk
index 6049d0e3a4..f55d2f5e81 100644
--- a/src/sbbs3/targets.mk
+++ b/src/sbbs3/targets.mk
@@ -158,6 +158,7 @@ FORCE:
 ifneq ($(GIT), NO)
 git_hash.h: FORCE ../../.git
 	$(QUIET)echo '#define GIT_HASH "'`git log -1 HEAD --format=%h`\" > $@.tmp
+	$(QUIET)echo '#define GIT_DATE "'`git log -1 HEAD --format=%cd '--date=format-local:%b %e %Y %H:%M'`\" >> $@.tmp
 	$(QUIET)test -e $@ && diff $@.tmp $@ || cp $@.tmp $@
 	$(QUIET)rm -f $@.tmp
 
diff --git a/src/sbbs3/ver.cpp b/src/sbbs3/ver.cpp
index 789d4f2c63..b0ee0072af 100644
--- a/src/sbbs3/ver.cpp
+++ b/src/sbbs3/ver.cpp
@@ -32,6 +32,7 @@ extern "C" {
 #endif
 
 const char* git_hash = GIT_HASH;
+const char* git_date = GIT_DATE;
 const char* git_branch = GIT_BRANCH;
 const char* beta_version = " "; /* Space if non-beta, " beta" otherwise */
 
@@ -94,7 +95,7 @@ void sbbs_t::ver()
 	center(str);
 	CRLF;
 
-	center("https://gitlab.synchro.net - " GIT_BRANCH "/" GIT_HASH); 
+	center(GIT_BRANCH "/" GIT_HASH " - " GIT_DATE);
 	CRLF;
 
 	sprintf(str,"%s - http://synchro.net", COPYRIGHT_NOTICE);
diff --git a/src/sbbs3/ver.h b/src/sbbs3/ver.h
index 2886059293..3d82ec628e 100644
--- a/src/sbbs3/ver.h
+++ b/src/sbbs3/ver.h
@@ -27,10 +27,11 @@ extern "C" {
 #endif
 
 extern const char* git_hash;
+extern const char* git_date;
 extern const char* git_branch;
 extern const char* beta_version;
 
 #ifdef __cplusplus
 }
 #endif
-#endif /* Don't add anything after this line */
\ No newline at end of file
+#endif /* Don't add anything after this line */
-- 
GitLab