Skip to content
Snippets Groups Projects
Commit a6438b2f authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Merge branch 'supermuc_fix' into 'master'

Fix in the case where the git branch and revision cannot be recovered.



See merge request !67
parents 37557ef1 97241530
Branches
Tags
1 merge request!136Master
...@@ -32,8 +32,17 @@ ...@@ -32,8 +32,17 @@
* Will include -dirty if they are local modifications. * Will include -dirty if they are local modifications.
*/ */
const char *git_revision(void) { const char *git_revision(void) {
static char buf[256];
static int initialised = 0;
static const char *revision = GIT_REVISION; static const char *revision = GIT_REVISION;
return revision; if(!initialised) {
if(strlen(revision) == 0)
sprintf(buf, "Unknown");
else
sprintf(buf, revision);
initialised = 1;
}
return buf;
} }
/** /**
...@@ -42,8 +51,17 @@ const char *git_revision(void) { ...@@ -42,8 +51,17 @@ const char *git_revision(void) {
* @details The name of the current branch when the code was last built. * @details The name of the current branch when the code was last built.
*/ */
const char *git_branch(void) { const char *git_branch(void) {
static char buf[256];
static int initialised = 0;
static const char *branch = GIT_BRANCH; static const char *branch = GIT_BRANCH;
return branch; if(!initialised) {
if(strlen(branch) == 0)
sprintf(buf, "Unknown");
else
sprintf(buf, branch);
initialised = 1;
}
return buf;
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment