diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-07-28 12:53:47 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-07-28 12:53:47 +0100 |
| commit | 6b032520d2e28a73c652b30c06a4b063f0534223 (patch) | |
| tree | f4847c7ae041826817a443c1e562692346cfcfc4 | |
| parent | 564941cdbc77154ae4d05bca33e2a6f60e7cca9d (diff) | |
feat(remote): report on `push`
pass outcome back to git to enable reporting
| -rw-r--r-- | src/git_remote_helper.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/git_remote_helper.rs b/src/git_remote_helper.rs index ded417f..64604a4 100644 --- a/src/git_remote_helper.rs +++ b/src/git_remote_helper.rs | |||
| @@ -75,7 +75,6 @@ async fn main() -> Result<()> { | |||
| 75 | .context("no git server listed in nostr repository announcement")?; | 75 | .context("no git server listed in nostr repository announcement")?; |
| 76 | 76 | ||
| 77 | let mut temp_remote = git_repo.git_repo.remote_anonymous(temp_remote_url)?; | 77 | let mut temp_remote = git_repo.git_repo.remote_anonymous(temp_remote_url)?; |
| 78 | |||
| 79 | loop { | 78 | loop { |
| 80 | let tokens = read_line(&stdin, &mut line)?; | 79 | let tokens = read_line(&stdin, &mut line)?; |
| 81 | 80 | ||
| @@ -104,6 +103,14 @@ async fn main() -> Result<()> { | |||
| 104 | let mut push_options = git2::PushOptions::new(); | 103 | let mut push_options = git2::PushOptions::new(); |
| 105 | let mut remote_callbacks = git2::RemoteCallbacks::new(); | 104 | let mut remote_callbacks = git2::RemoteCallbacks::new(); |
| 106 | remote_callbacks.credentials(auth.credentials(&git_config)); | 105 | remote_callbacks.credentials(auth.credentials(&git_config)); |
| 106 | remote_callbacks.push_update_reference(|name, error| { | ||
| 107 | if let Some(error) = error { | ||
| 108 | println!("error {name} {error}"); | ||
| 109 | } else { | ||
| 110 | println!("ok {name}",); | ||
| 111 | } | ||
| 112 | Ok(()) | ||
| 113 | }); | ||
| 107 | push_options.remote_callbacks(remote_callbacks); | 114 | push_options.remote_callbacks(remote_callbacks); |
| 108 | temp_remote.push( | 115 | temp_remote.push( |
| 109 | &get_refspecs_from_push_batch(&stdin, refspec)?, | 116 | &get_refspecs_from_push_batch(&stdin, refspec)?, |