Skip to content

Commit 823c240

Browse files
committed
fix: Push status - If there are remote commits, force push is required
If there are upstream commits in a branch, despite it having local or local-and-remote commits, pushing would remove the remote only commits and, in turn, require a force push
1 parent ca775b5 commit 823c240

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

crates/but-workspace/src/changeset.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,12 +244,12 @@ impl PushStatus {
244244
&& matches!(c.relation, LocalCommitRelation::Integrated(_)))
245245
}) {
246246
PushStatus::UnpushedCommitsRequiringForce
247+
} else if remote_has_commits {
248+
// If there are remote commits, pushing would require a force push, as the remote-only
249+
// commits would be overwritten.
250+
PushStatus::UnpushedCommitsRequiringForce
247251
} else if first_commit_is_local {
248-
if remote_has_commits {
249-
PushStatus::UnpushedCommitsRequiringForce
250-
} else {
251-
PushStatus::UnpushedCommits
252-
}
252+
PushStatus::UnpushedCommits
253253
} else {
254254
PushStatus::NothingToPush
255255
}

0 commit comments

Comments
 (0)