Skip to content
Snippets Groups Projects
Commit 2d9e042b authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

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.
parent d0b64279
No related branches found
No related tags found
1 merge request!455Update branch with changes from master
@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
......@@ -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
......
......@@ -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);
......
......@@ -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 */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment