From 02ad2b78faf190fb9bc545ccdfadb091913c17c1 Mon Sep 17 00:00:00 2001 From: kalaposfos13 <153381648+kalaposfos13@users.noreply.github.com> Date: Mon, 3 Feb 2025 11:53:57 +0100 Subject: [PATCH] Fork detection: Fix Windows naming + add a new check for fork detection (#2321) * Possible fix for Windows * Check if remote.pushDefault is set when generating the remote link * Remove left-in lines I missed before --- CMakeLists.txt | 15 +++++++++++++-- src/emulator.cpp | 10 +++++++--- src/qt_gui/main_window.cpp | 10 +++++++--- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4822658c6..b0e1115b3 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,9 +115,20 @@ execute_process( OUTPUT_STRIP_TRAILING_WHITESPACE ) -# Default to origin if there's no upstream set or if the command failed +# If there's no upstream set or the command failed, check remote.pushDefault if (GIT_BRANCH_RESULT OR GIT_REMOTE_NAME STREQUAL "") - set(GIT_REMOTE_NAME "origin") + execute_process( + COMMAND git config --get remote.pushDefault + OUTPUT_VARIABLE GIT_REMOTE_NAME + RESULT_VARIABLE GIT_PUSH_DEFAULT_RESULT + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + # If remote.pushDefault is not set or fails, default to origin + if (GIT_PUSH_DEFAULT_RESULT OR GIT_REMOTE_NAME STREQUAL "") + set(GIT_REMOTE_NAME "origin") + endif() else() # Extract remote name if the output contains a remote/branch format string(FIND "${GIT_REMOTE_NAME}" "/" INDEX) diff --git a/src/emulator.cpp b/src/emulator.cpp index ba8d8917c..cd981add2 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -201,12 +201,16 @@ void Emulator::Run(const std::filesystem::path& file, const std::vector