Fork detection: Fix Windows naming + add a new check for fork detection (#2321)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / linux-qt-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions

* Possible fix for Windows

* Check if remote.pushDefault is set when generating the remote link

* Remove left-in lines I missed before
This commit is contained in:
kalaposfos13 2025-02-03 11:53:57 +01:00 committed by GitHub
parent cef7edaea9
commit 02ad2b78fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 8 deletions

View file

@ -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)

View file

@ -201,12 +201,16 @@ void Emulator::Run(const std::filesystem::path& file, const std::vector<std::str
window_title = fmt::format("shadPS4 v{} | {}", Common::VERSION, game_title);
} else {
std::string remote_url(Common::g_scm_remote_url);
if (remote_url == "https://github.com/shadps4-emu/shadPS4.git" ||
remote_url.length() == 0) {
std::string remote_host;
try {
remote_host = remote_url.substr(19, remote_url.rfind('/') - 19);
} catch (...) {
remote_host = "unknown";
}
if (remote_host == "shadps4-emu" || remote_url.length() == 0) {
window_title = fmt::format("shadPS4 v{} {} {} | {}", Common::VERSION,
Common::g_scm_branch, Common::g_scm_desc, game_title);
} else {
std::string remote_host = remote_url.substr(19, remote_url.rfind('/') - 19);
window_title = fmt::format("shadPS4 v{} {}/{} {} | {}", Common::VERSION, remote_host,
Common::g_scm_branch, Common::g_scm_desc, game_title);
}

View file

@ -62,12 +62,16 @@ bool MainWindow::Init() {
window_title = fmt::format("shadPS4 v{}", Common::VERSION);
} else {
std::string remote_url(Common::g_scm_remote_url);
if (remote_url == "https://github.com/shadps4-emu/shadPS4.git" ||
remote_url.length() == 0) {
std::string remote_host;
try {
remote_host = remote_url.substr(19, remote_url.rfind('/') - 19);
} catch (...) {
remote_host = "unknown";
}
if (remote_host == "shadps4-emu" || remote_url.length() == 0) {
window_title = fmt::format("shadPS4 v{} {} {}", Common::VERSION, Common::g_scm_branch,
Common::g_scm_desc);
} else {
std::string remote_host = remote_url.substr(19, remote_url.rfind('/') - 19);
window_title = fmt::format("shadPS4 v{} {}/{} {}", Common::VERSION, remote_host,
Common::g_scm_branch, Common::g_scm_desc);
}