summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-04-22 18:33:30 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-04-22 18:33:30 +0200
commitfa38dfd416b664033a96bb4af764fd54f7257d7b (patch)
tree91688653ab761b4214ca6261376f506ce1d5c5f2
parentd7b3145b2e9af0ea2779a52e0c3b10b6f4a84334 (diff)
Added git dirty
-rw-r--r--CMakeLists.txt7
-rw-r--r--src/debug/HyprCtl.cpp2
-rw-r--r--src/defines.hpp5
3 files changed, 12 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4cd662f1..a3b3584e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,6 +26,12 @@ execute_process(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_MESSAGE
OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+execute_process(
+ COMMAND bash -c "git diff-index --quiet HEAD -- || echo \"dirty\""
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ OUTPUT_VARIABLE GIT_DIRTY
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
#
#
@@ -61,6 +67,7 @@ ENDIF(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
target_compile_definitions(Hyprland PRIVATE "-DGIT_COMMIT_HASH=\"${GIT_COMMIT_HASH}\"")
target_compile_definitions(Hyprland PRIVATE "-DGIT_BRANCH=\"${GIT_BRANCH}\"")
target_compile_definitions(Hyprland PRIVATE "-DGIT_COMMIT_MESSAGE=\"${GIT_COMMIT_MESSAGE}\"")
+target_compile_definitions(Hyprland PRIVATE "-DGIT_DIRTY=\"${GIT_DIRTY}\"")
target_link_libraries(Hyprland rt)
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp
index 6986b601..a3a91cca 100644
--- a/src/debug/HyprCtl.cpp
+++ b/src/debug/HyprCtl.cpp
@@ -72,7 +72,7 @@ std::string layersRequest() {
}
std::string versionRequest() {
- std::string result = "Hyprland, built from branch " + std::string(GIT_BRANCH) + " at commit " + GIT_COMMIT_HASH + " (" + GIT_COMMIT_MESSAGE + ").\nflags: (if any)\n";
+ std::string result = "Hyprland, built from branch " + std::string(GIT_BRANCH) + " at commit " + GIT_COMMIT_HASH + GIT_DIRTY + " (" + GIT_COMMIT_MESSAGE + ").\nflags: (if any)\n";
#ifdef LEGACY_RENDERER
result += "legacyrenderer\n";
diff --git a/src/defines.hpp b/src/defines.hpp
index 13701a03..a803b985 100644
--- a/src/defines.hpp
+++ b/src/defines.hpp
@@ -60,4 +60,7 @@
#endif
#ifndef GIT_COMMIT_MESSAGE
#define GIT_COMMIT_MESSAGE "?"
-#endif \ No newline at end of file
+#endif
+#ifndef GIT_DIRTY
+#define GIT_DIRTY "?"
+#endif