Do not overwrite compbranch in case of detached HEAD

This commit is contained in:
James R 2023-01-05 18:15:15 -08:00
parent 55636fa690
commit 94e3050f10
4 changed files with 16 additions and 9 deletions

View file

@ -1189,6 +1189,17 @@ D_ConvertVersionNumbers (void)
#endif
}
const char *D_GetFancyBranchName(void)
{
if (!strcmp(compbranch, ""))
{
// \x8b = aqua highlight
return "\x8b" "detached HEAD" "\x80";
}
return compbranch;
}
//
// D_SRB2Main
//
@ -1206,12 +1217,6 @@ void D_SRB2Main(void)
/* break the version string into version numbers, for netplay */
D_ConvertVersionNumbers();
if (!strcmp(compbranch, ""))
{
// \x8b = aqua highlight
compbranch = "\x8b" "detached HEAD" "\x80";
}
#ifdef DEVELOP
D_AbbrevCommit();
#endif

View file

@ -42,6 +42,8 @@ void D_SRB2Loop(void) FUNCNORETURN;
//
void D_SRB2Main(void);
const char *D_GetFancyBranchName(void);
// Called by IO functions when input is detected.
void D_PostEvent(const event_t *ev);
#if defined (PC_DOS) && !defined (DOXYGEN)

View file

@ -4772,9 +4772,9 @@ static void Command_ListDoomednums_f(void)
static void Command_Version_f(void)
{
#ifdef DEVELOP
CONS_Printf("Ring Racers %s %s %s (%s %s)\n", compbranch, comprevision, compnote, compdate, comptime);
CONS_Printf("Ring Racers %s %s %s (%s %s)\n", D_GetFancyBranchName(), comprevision, compnote, compdate, comptime);
#else
CONS_Printf("Ring Racers %s (%s %s %s %s) ", VERSIONSTRING, compdate, comptime, comprevision, compbranch);
CONS_Printf("Ring Racers %s (%s %s %s %s) ", VERSIONSTRING, compdate, comptime, comprevision, D_GetFancyBranchName());
#endif
// Base library

View file

@ -1914,7 +1914,7 @@ void F_VersionDrawer(void)
addtext(V_ALLOWLOWERCASE|V_TRANSLUCENT, va("%s", compdate));
#elif defined(DEVELOP)
addtext(V_ALLOWLOWERCASE|V_TRANSLUCENT, va("%s %s", comprevision, compnote));
addtext(V_ALLOWLOWERCASE|V_TRANSLUCENT, compbranch);
addtext(V_ALLOWLOWERCASE|V_TRANSLUCENT, D_GetFancyBranchName());
#else // Regular build
addtext(V_ALLOWLOWERCASE|V_TRANSLUCENT, va("%s", VERSIONSTRING));
#endif