mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-28 23:55:54 +00:00
git: return error instead of panicking on unexpected libgit2 error
This is obviously what I meant to do in the commit that introduced the code.
This commit is contained in:
parent
aea1ea3707
commit
634a04e234
1 changed files with 2 additions and 2 deletions
|
@ -88,7 +88,7 @@ pub fn push_commit(
|
|||
(git2::ErrorClass::Config, git2::ErrorCode::InvalidSpec) => {
|
||||
GitPushError::NoSuchRemote
|
||||
}
|
||||
_ => panic!("unhandled git error: {:?}", err),
|
||||
_ => GitPushError::InternalGitError(format!("unhandled git error: {:?}", err)),
|
||||
})?;
|
||||
// Need to add "refs/heads/" prefix due to https://github.com/libgit2/libgit2/issues/1125
|
||||
let refspec = format!("{}:refs/heads/{}", temp_ref_name, remote_branch);
|
||||
|
@ -98,7 +98,7 @@ pub fn push_commit(
|
|||
(git2::ErrorClass::Reference, git2::ErrorCode::NotFastForward) => {
|
||||
GitPushError::NotFastForward
|
||||
}
|
||||
_ => panic!("unhandled git error: {:?}", err),
|
||||
_ => GitPushError::InternalGitError(format!("unhandled git error: {:?}", err)),
|
||||
})?;
|
||||
temp_ref.delete().map_err(|err| {
|
||||
GitPushError::InternalGitError(format!(
|
||||
|
|
Loading…
Reference in a new issue