ok/jj
1
0
Fork 0
forked from mirrors/jj

jj git push: remove the NotFastForward error

Now that we always force push, it should not occur in practice.
This commit is contained in:
Ilya Grigoriev 2024-04-17 21:59:33 -07:00
parent 12081166f6
commit e3bb825a21
2 changed files with 1 additions and 16 deletions

View file

@ -1015,11 +1015,6 @@ fn cmd_git_push(
})
.map_err(|err| match err {
GitPushError::InternalGitError(err) => map_git_error(err),
GitPushError::NotFastForward => user_error_with_hint(
"The push conflicts with changes made on the remote (it is not fast-forwardable).",
"Try fetching from the remote, then make the branch point to where you want it to be, \
and push again.",
),
GitPushError::RefInUnexpectedLocation(refs) => user_error_with_hint(
format!(
"Refusing to push a branch that unexpectedly moved on the remote. Affected refs: \

View file

@ -1223,9 +1223,6 @@ pub enum GitPushError {
name = REMOTE_NAME_FOR_LOCAL_GIT_REPO
)]
RemoteReservedForLocalGitRepo,
// Short-term TODO: Delete this; it should never trigger
#[error("Push is not fast-forwardable")]
NotFastForward,
#[error("Refs in unexpected location: {0:?}")]
RefInUnexpectedLocation(Vec<String>),
#[error("Remote rejected the update of some refs (do you have permission to push to {0:?}?)")]
@ -1422,14 +1419,7 @@ fn push_refs(
Ok(())
});
push_options.remote_callbacks(callbacks);
remote
.push(refspecs, Some(&mut push_options))
.map_err(|err| match (err.class(), err.code()) {
(git2::ErrorClass::Reference, git2::ErrorCode::NotFastForward) => {
GitPushError::NotFastForward
}
_ => GitPushError::InternalGitError(err),
})
remote.push(refspecs, Some(&mut push_options))
};
if !failed_push_negotiations.is_empty() {
// If the push negotiation returned an error, `remote.push` would not