diff --git a/src/stack/transaction/mod.rs b/src/stack/transaction/mod.rs index 6900b821..f16e872e 100644 --- a/src/stack/transaction/mod.rs +++ b/src/stack/transaction/mod.rs @@ -1090,6 +1090,7 @@ impl<'repo> StackTransaction<'repo> { conflicts: false, })?; self.current_tree_id = tree_id; + push_status = PushStatus::Modified; tree_id } Ok(false) => { @@ -1130,12 +1131,10 @@ impl<'repo> StackTransaction<'repo> { // execute() performs the checkout. Setting the transaction head // here ensures that the real stack top will be checked-out. self.updated_head = Some(commit.clone()); - } else if push_status != PushStatus::AlreadyMerged { - if new_tree_id == new_parent_ref.tree() { - push_status = PushStatus::Empty; - } else { - push_status = PushStatus::Modified; - } + } else if push_status != PushStatus::AlreadyMerged + && new_tree_id == new_parent_ref.tree() + { + push_status = PushStatus::Empty; } self.updated_patches diff --git a/t/t1204-push-updated.sh b/t/t1204-push-updated.sh index 8adf43ae..08e6e578 100755 --- a/t/t1204-push-updated.sh +++ b/t/t1204-push-updated.sh @@ -49,9 +49,13 @@ test_expect_success 'Move hunk to p0' ' stg refresh ' -test_expect_success 'Push indicates p1 was modified' ' +# NOTE: since StGit started using --3way when pushing patches, it is no longer +# trivial to determine whether a patch was "modified" due to the push. In this +# test, the status would ideally be "(modified)", but in practice StGit cannot +# determine that cheaply. +test_expect_success 'Push indicates p1 was not modified' ' cat >expected <<-\EOF && - > p1 (modified) + > p1 EOF stg push p1 >out && test_cmp expected out