Skip to content

Commit 9796321

Browse files
committed
Auto merge of #2207 - rust-lang:sg-fix-bug, r=pietroalbini
Don't return `Ok` if update handler isn't run We're losing jobs to publish crates. It's not clear why. The requests are returning 200, which implies they are being queued correctly. There is no log to indicate that these jobs failed, so right now I believe that this job is erroneously returning `Ok` when it failed. Given GitHub is having a partial outage, that seems to reinforce this theory. From looking at the code, this looks like the only way we could have returned `Ok` when the publish failed. I believe we got some sort of error response (or lack of one) from GitHub that caused this callback not to be run.
2 parents c8845f5 + 09814cc commit 9796321

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/git.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ impl Repository {
203203

204204
// git push
205205
let mut ref_status = Ok(());
206+
let mut callback_called = false;
206207
{
207208
let mut origin = self.repository.find_remote("origin")?;
208209
let mut callbacks = git2::RemoteCallbacks::new();
@@ -214,12 +215,18 @@ impl Repository {
214215
if let Some(s) = status {
215216
ref_status = Err(format!("failed to push a ref: {}", s).into())
216217
}
218+
callback_called = true;
217219
Ok(())
218220
});
219221
let mut opts = git2::PushOptions::new();
220222
opts.remote_callbacks(callbacks);
221223
origin.push(&["refs/heads/master"], Some(&mut opts))?;
222224
}
225+
226+
if !callback_called {
227+
ref_status = Err("update_reference callback was not called".into());
228+
}
229+
223230
ref_status
224231
}
225232

0 commit comments

Comments
 (0)