aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2023-07-23 19:43:15 +0200
committervaxerski <[email protected]>2023-07-23 19:43:15 +0200
commit975c4175b2db65e9b0e6bea79111cb2c4e5e4ca1 (patch)
treefc9f53fcefb7398597bab5a3696a9448eafe8dd7
parentaf395a8f5514a978151e237dbf284c49c9422a82 (diff)
downloadHyprland-975c4175b2db65e9b0e6bea79111cb2c4e5e4ca1.tar.gz
Hyprland-975c4175b2db65e9b0e6bea79111cb2c4e5e4ca1.zip
hyprctl: unify and sanitize ver commit msg better
-rw-r--r--src/debug/HyprCtl.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp
index 03c556db..d01b3ffd 100644
--- a/src/debug/HyprCtl.cpp
+++ b/src/debug/HyprCtl.cpp
@@ -630,9 +630,12 @@ std::string bindsRequest(HyprCtl::eHyprCtlOutputFormat format) {
std::string versionRequest(HyprCtl::eHyprCtlOutputFormat format) {
+ auto commitMsg = removeBeginEndSpacesTabs(GIT_COMMIT_MESSAGE);
+ std::replace(commitMsg.begin(), commitMsg.end(), '#', ' ');
+
if (format == HyprCtl::eHyprCtlOutputFormat::FORMAT_NORMAL) {
- std::string result = "Hyprland, built from branch " + std::string(GIT_BRANCH) + " at commit " + GIT_COMMIT_HASH + " " + GIT_DIRTY + " (" +
- removeBeginEndSpacesTabs(GIT_COMMIT_MESSAGE).c_str() + ").\nTag: " + GIT_TAG + "\n\nflags: (if any)\n";
+ std::string result = "Hyprland, built from branch " + std::string(GIT_BRANCH) + " at commit " + GIT_COMMIT_HASH + " " + GIT_DIRTY + " (" + commitMsg +
+ ").\nTag: " + GIT_TAG + "\n\nflags: (if any)\n";
#ifdef LEGACY_RENDERER
result += "legacyrenderer\n";
@@ -656,7 +659,7 @@ std::string versionRequest(HyprCtl::eHyprCtlOutputFormat format) {
"dirty": %s,
"commit_message": "%s",
"flags": [)#",
- GIT_BRANCH, GIT_COMMIT_HASH, (strcmp(GIT_DIRTY, "dirty") == 0 ? "true" : "false"), removeBeginEndSpacesTabs(GIT_COMMIT_MESSAGE).c_str());
+ GIT_BRANCH, GIT_COMMIT_HASH, (strcmp(GIT_DIRTY, "dirty") == 0 ? "true" : "false"), escapeJSONStrings(commitMsg).c_str());
#ifdef LEGACY_RENDERER
result += "\"legacyrenderer\",";