Print on the title screen and in console if there are uncommitted changes

This commit is contained in:
James R 2022-09-29 15:18:41 -07:00
parent 495c58e53f
commit 62b2718261
5 changed files with 21 additions and 0 deletions

View file

@ -195,6 +195,14 @@ passthru_opts:=
# separate suffix with an underscore # separate suffix with an underscore
exesuffix:=$(call _,$(EXESUFFIX)) exesuffix:=$(call _,$(EXESUFFIX))
# If there are uncommitted changes
# -uno: disregard untracked files
# Warning: this can only be accurate for comptime.c since
# that file is always recompiled!
ifneq ($(shell git status --porcelain -uno),)
opts+=-DCOMPVERSION_UNCOMMITTED
endif
include Makefile.d/platform.mk include Makefile.d/platform.mk
include Makefile.d/features.mk include Makefile.d/features.mk
include Makefile.d/versions.mk include Makefile.d/versions.mk

View file

@ -15,6 +15,13 @@ const char *comprevision = SRB2_COMP_REVISION;
#elif (defined(COMPVERSION)) #elif (defined(COMPVERSION))
#include "comptime.h" #include "comptime.h"
const int compuncommitted =
#if (defined(COMPVERSION_UNCOMMITTED))
1;
#else
0;
#endif
#else #else
const char *compbranch = "Unknown"; const char *compbranch = "Unknown";
const char *comprevision = "illegal"; const char *comprevision = "illegal";

View file

@ -4756,6 +4756,9 @@ static void Command_Version_f(void)
CONS_Printf("\x87" "DEVELOP " "\x80"); CONS_Printf("\x87" "DEVELOP " "\x80");
#endif #endif
if (compuncommitted)
CONS_Printf("\x85" "! UNCOMMITTED CHANGES ! " "\x80");
CONS_Printf("\n"); CONS_Printf("\n");
} }

View file

@ -613,6 +613,7 @@ UINT32 quickncasehash (const char *p, size_t n)
// Compile date and time and revision. // Compile date and time and revision.
extern const char *compdate, *comptime, *comprevision, *compbranch; extern const char *compdate, *comptime, *comprevision, *compbranch;
extern int compuncommitted;
// Disabled code and code under testing // Disabled code and code under testing
// None of these that are disabled in the normal build are guaranteed to work perfectly // None of these that are disabled in the normal build are guaranteed to work perfectly

View file

@ -2006,6 +2006,8 @@ void F_TitleScreenDrawer(void)
#else // Regular build #else // Regular build
addtext(V_ALLOWLOWERCASE|V_TRANSLUCENT, va("%s", VERSIONSTRING)); addtext(V_ALLOWLOWERCASE|V_TRANSLUCENT, va("%s", VERSIONSTRING));
#endif #endif
if (compuncommitted)
addtext(V_REDMAP|V_STRINGDANCE, "! UNCOMMITTED CHANGES !");
} }
#undef addtext #undef addtext
} }