From e3bb825a21699e704356cb1f262d7cb3be4ed52e Mon Sep 17 00:00:00 2001 From: Ilya Grigoriev Date: Wed, 17 Apr 2024 21:59:33 -0700 Subject: [PATCH] jj git push: remove the NotFastForward error Now that we always force push, it should not occur in practice. --- cli/src/commands/git.rs | 5 ----- lib/src/git.rs | 12 +----------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/cli/src/commands/git.rs b/cli/src/commands/git.rs index a8b4cf0129..994868fbf6 100644 --- a/cli/src/commands/git.rs +++ b/cli/src/commands/git.rs @@ -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: \ diff --git a/lib/src/git.rs b/lib/src/git.rs index 3a90501055..6b8e132b41 100644 --- a/lib/src/git.rs +++ b/lib/src/git.rs @@ -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), #[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