Skip to content

Don't return Ok if update handler isn't run #2207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ impl Repository {

// git push
let mut ref_status = Ok(());
let mut callback_called = false;
{
let mut origin = self.repository.find_remote("origin")?;
let mut callbacks = git2::RemoteCallbacks::new();
Expand All @@ -214,12 +215,18 @@ impl Repository {
if let Some(s) = status {
ref_status = Err(format!("failed to push a ref: {}", s).into())
}
callback_called = true;
Ok(())
});
let mut opts = git2::PushOptions::new();
opts.remote_callbacks(callbacks);
origin.push(&["refs/heads/master"], Some(&mut opts))?;
}

if !callback_called {
ref_status = Err("update_reference callback was not called".into());
}

ref_status
}

Expand Down