upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-07-28 11:31:06 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2024-07-28 11:31:06 +0100
commitf2e674b5b90f891bd56247d370b047c7c81d33e3 (patch)
treef7cb99bd8931e2b34d4674a905a8425192e5606c /src
parent6bbb54cd736fc46e921df682ba6306186d710ba4 (diff)
refactor(remote): allow more `push` callbacks
by using GitAuthenticatior credential callback directly rather than its `push` method
Diffstat (limited to 'src')
-rw-r--r--src/git_remote_helper.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/git_remote_helper.rs b/src/git_remote_helper.rs
index e6991d6..6e8f70f 100644
--- a/src/git_remote_helper.rs
+++ b/src/git_remote_helper.rs
@@ -99,9 +99,13 @@ async fn main() -> Result<()> {
99 println!(); 99 println!();
100 } 100 }
101 ["push", refspec] => { 101 ["push", refspec] => {
102 // Why are new branches being pushed without -u?
103 let auth = GitAuthenticator::default(); 102 let auth = GitAuthenticator::default();
104 auth.push(&git_repo.git_repo, &mut temp_remote, &[refspec])?; 103 let git_config = git_repo.git_repo.config()?;
104 let mut push_options = git2::PushOptions::new();
105 let mut remote_callbacks = git2::RemoteCallbacks::new();
106 remote_callbacks.credentials(auth.credentials(&git_config));
107 push_options.remote_callbacks(remote_callbacks);
108 temp_remote.push(&[refspec], Some(&mut push_options))?;
105 update_remote_refs_from_push_refspecs(&git_repo.git_repo, refspec, url)?; 109 update_remote_refs_from_push_refspecs(&git_repo.git_repo, refspec, url)?;
106 temp_remote.disconnect()?; 110 temp_remote.disconnect()?;
107 println!(); 111 println!();