Skip to content

Commit

Permalink
jj git push: remove the NotFastForward error
Browse files Browse the repository at this point in the history
Now that we always force push, it should not occur in practice.
  • Loading branch information
ilyagr committed May 29, 2024
1 parent 1208116 commit e3bb825
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
5 changes: 0 additions & 5 deletions cli/src/commands/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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: \
Expand Down
12 changes: 1 addition & 11 deletions lib/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:?}?)")]
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e3bb825

Please sign in to comment.