Skip to content

Commit 0749704

Browse files
committed
Version: report git commit hash
1 parent 9977cb6 commit 0749704

File tree

5 files changed

+6
-3
lines changed

5 files changed

+6
-3
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,10 @@ if (SET_TWEAK AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
202202
execute_process(
203203
COMMAND git describe --tags
204204
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
205-
OUTPUT_VARIABLE PROJECT_VERSION_TWEAK
205+
OUTPUT_VARIABLE PROJECT_VERSION_GIT
206206
OUTPUT_STRIP_TRAILING_WHITESPACE
207207
)
208-
string(REGEX MATCH "-[0-9]+" PROJECT_VERSION_TWEAK "${PROJECT_VERSION_TWEAK}")
208+
string(REGEX MATCH "-[0-9]+" PROJECT_VERSION_TWEAK "${PROJECT_VERSION_GIT}")
209209
endif()
210210
if(PROJECT_VERSION_TWEAK)
211211
string(REGEX MATCH "[0-9]+" PROJECT_VERSION_TWEAK_NUM "${PROJECT_VERSION_TWEAK}")

src/detection/version/version.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ FFVersionResult ffVersionResult = {
4444
.architecture = FF_ARCHITECTURE,
4545
.version = FASTFETCH_PROJECT_VERSION,
4646
.versionTweak = FASTFETCH_PROJECT_VERSION_TWEAK,
47+
.versionGit = FASTFETCH_PROJECT_VERSION_GIT,
4748
.cmakeBuiltType = FASTFETCH_PROJECT_CMAKE_BUILD_TYPE,
4849
.compileTime = __DATE__ ", " __TIME__,
4950
.compiler =

src/detection/version/version.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ typedef struct FFVersionResult
99
const char* architecture;
1010
const char* version;
1111
const char* versionTweak;
12+
const char* versionGit;
1213
const char* cmakeBuiltType;
1314
const char* compileTime;
1415
const char* compiler;

src/fastfetch_config.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#define FASTFETCH_PROJECT_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
99
#define FASTFETCH_PROJECT_VERSION_MINOR @PROJECT_VERSION_MINOR@
1010
#define FASTFETCH_PROJECT_VERSION_PATCH @PROJECT_VERSION_PATCH@
11+
#define FASTFETCH_PROJECT_VERSION_GIT "@PROJECT_VERSION_GIT@"
1112
#define FASTFETCH_PROJECT_VERSION_TWEAK "@PROJECT_VERSION_TWEAK@"
1213
#define FASTFETCH_PROJECT_VERSION_TWEAK_NUM @PROJECT_VERSION_TWEAK_NUM@
1314
#define FASTFETCH_PROJECT_CMAKE_BUILD_TYPE "@CMAKE_BUILD_TYPE@"

src/modules/version/version.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ void ffGenerateVersionJsonResult(FF_MAYBE_UNUSED FFVersionOptions* options, yyjs
8989
yyjson_mut_obj_add_str(doc, obj, "sysName", result->sysName);
9090
yyjson_mut_obj_add_str(doc, obj, "architecture", result->architecture);
9191
yyjson_mut_obj_add_str(doc, obj, "version", result->version);
92-
yyjson_mut_obj_add_str(doc, obj, "versionTweak", result->versionTweak);
92+
yyjson_mut_obj_add_str(doc, obj, "versionGit", result->versionGit);
9393
yyjson_mut_obj_add_str(doc, obj, "cmakeBuiltType", result->cmakeBuiltType);
9494
yyjson_mut_obj_add_str(doc, obj, "compileTime", result->compileTime);
9595
yyjson_mut_obj_add_str(doc, obj, "compiler", result->compiler);

0 commit comments

Comments
 (0)