From e6611dd1e20def153220444f62d9d8fafeaea82c Mon Sep 17 00:00:00 2001 From: wiiznokes <78230769+wiiznokes@users.noreply.github.com> Date: Sun, 4 Jan 2026 13:45:01 +0100 Subject: [PATCH 1/2] Update mod.rs --- app/src/main/rust/src/libgit2/mod.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/app/src/main/rust/src/libgit2/mod.rs b/app/src/main/rust/src/libgit2/mod.rs index da347b4..3e558f8 100644 --- a/app/src/main/rust/src/libgit2/mod.rs +++ b/app/src/main/rust/src/libgit2/mod.rs @@ -241,6 +241,16 @@ pub fn commit_all(name: &str, email: &str, message: &str) -> Result<(), Error> { pub fn push(cred: Option) -> Result<(), Error> { apply_ssh_workaround(false); + unsafe { + libgit2_sys::git_libgit2_opts( + libgit2_sys::GIT_OPT_SET_SERVER_CONNECT_TIMEOUT as std::ffi::c_int, + 7000, + ); + libgit2_sys::git_libgit2_opts( + libgit2_sys::GIT_OPT_SET_SERVER_TIMEOUT as std::ffi::c_int, + 7000, + ); + }; let repo = REPO.lock().expect("repo lock"); let repo = repo.as_ref().expect("repo"); @@ -272,6 +282,17 @@ pub fn push(cred: Option) -> Result<(), Error> { pub fn pull(cred: Option, author: &GitAuthor) -> Result<(), Error> { apply_ssh_workaround(false); + unsafe { + libgit2_sys::git_libgit2_opts( + libgit2_sys::GIT_OPT_SET_SERVER_CONNECT_TIMEOUT as std::ffi::c_int, + 7000, + ); + libgit2_sys::git_libgit2_opts( + libgit2_sys::GIT_OPT_SET_SERVER_TIMEOUT as std::ffi::c_int, + 7000, + ); + }; + let repo = REPO.lock().expect("repo lock"); let repo = repo.as_ref().expect("repo"); From 6789afb5c25ce10505b917c25862e5d2a76cd995 Mon Sep 17 00:00:00 2001 From: wiiznokes <78230769+wiiznokes@users.noreply.github.com> Date: Mon, 5 Jan 2026 16:58:17 +0100 Subject: [PATCH 2/2] Update mod.rs --- app/src/main/rust/src/libgit2/mod.rs | 32 +++++++++++----------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/app/src/main/rust/src/libgit2/mod.rs b/app/src/main/rust/src/libgit2/mod.rs index 3e558f8..b5f4a98 100644 --- a/app/src/main/rust/src/libgit2/mod.rs +++ b/app/src/main/rust/src/libgit2/mod.rs @@ -80,6 +80,17 @@ pub fn init_lib(home_path: String) { error!("gitconfig: {e}"); } } + + unsafe { + libgit2_sys::git_libgit2_opts( + libgit2_sys::GIT_OPT_SET_SERVER_CONNECT_TIMEOUT as std::ffi::c_int, + 7000, + ); + libgit2_sys::git_libgit2_opts( + libgit2_sys::GIT_OPT_SET_SERVER_TIMEOUT as std::ffi::c_int, + 7000, + ); + }; } pub fn create_repo(repo_path: &str) -> Result<(), Error> { @@ -241,16 +252,7 @@ pub fn commit_all(name: &str, email: &str, message: &str) -> Result<(), Error> { pub fn push(cred: Option) -> Result<(), Error> { apply_ssh_workaround(false); - unsafe { - libgit2_sys::git_libgit2_opts( - libgit2_sys::GIT_OPT_SET_SERVER_CONNECT_TIMEOUT as std::ffi::c_int, - 7000, - ); - libgit2_sys::git_libgit2_opts( - libgit2_sys::GIT_OPT_SET_SERVER_TIMEOUT as std::ffi::c_int, - 7000, - ); - }; + let repo = REPO.lock().expect("repo lock"); let repo = repo.as_ref().expect("repo"); @@ -282,16 +284,6 @@ pub fn push(cred: Option) -> Result<(), Error> { pub fn pull(cred: Option, author: &GitAuthor) -> Result<(), Error> { apply_ssh_workaround(false); - unsafe { - libgit2_sys::git_libgit2_opts( - libgit2_sys::GIT_OPT_SET_SERVER_CONNECT_TIMEOUT as std::ffi::c_int, - 7000, - ); - libgit2_sys::git_libgit2_opts( - libgit2_sys::GIT_OPT_SET_SERVER_TIMEOUT as std::ffi::c_int, - 7000, - ); - }; let repo = REPO.lock().expect("repo lock"); let repo = repo.as_ref().expect("repo");