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 25, 2024
1 parent d2b202f commit 29f10a7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 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
10 changes: 1 addition & 9 deletions lib/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1209,9 +1209,6 @@ pub enum GitPushError {
name = REMOTE_NAME_FOR_LOCAL_GIT_REPO
)]
RemoteReservedForLocalGitRepo,
// 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 @@ -1424,12 +1421,7 @@ fn push_refs(
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),
})
.map_err(GitPushError::InternalGitError)
};
if !failed_push_negotiations.is_empty() {
// If the push negotiation returned an error, `remote.push` would not
Expand Down

0 comments on commit 29f10a7

Please sign in to comment.