Skip to content

Commit bc665cd

Browse files
rjustogitster
authored andcommitted
t4014: cleanups in a few tests
Arrange things we are going to create to be removed at end, and then start creating them. That way, we will clean them up even if we fail after creating some but before the end of the command. Signed-off-by: Rubén Justo <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 786a3e4 commit bc665cd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

t/t4014-format-patch.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -820,8 +820,8 @@ test_expect_success 'format-patch --notes --signoff' '
820820
'
821821

822822
test_expect_success 'format-patch notes output control' '
823+
test_when_finished "git notes remove HEAD || :" &&
823824
git notes add -m "notes config message" HEAD &&
824-
test_when_finished git notes remove HEAD &&
825825
826826
git format-patch -1 --stdout >out &&
827827
! grep "notes config message" out &&
@@ -848,10 +848,10 @@ test_expect_success 'format-patch notes output control' '
848848
'
849849

850850
test_expect_success 'format-patch with multiple notes refs' '
851+
test_when_finished "git notes --ref note1 remove HEAD;
852+
git notes --ref note2 remove HEAD || :" &&
851853
git notes --ref note1 add -m "this is note 1" HEAD &&
852-
test_when_finished git notes --ref note1 remove HEAD &&
853854
git notes --ref note2 add -m "this is note 2" HEAD &&
854-
test_when_finished git notes --ref note2 remove HEAD &&
855855
856856
git format-patch -1 --stdout >out &&
857857
! grep "this is note 1" out &&
@@ -892,10 +892,10 @@ test_expect_success 'format-patch with multiple notes refs' '
892892
test_expect_success 'format-patch with multiple notes refs in config' '
893893
test_when_finished "test_unconfig format.notes" &&
894894
895+
test_when_finished "git notes --ref note1 remove HEAD;
896+
git notes --ref note2 remove HEAD || :" &&
895897
git notes --ref note1 add -m "this is note 1" HEAD &&
896-
test_when_finished git notes --ref note1 remove HEAD &&
897898
git notes --ref note2 add -m "this is note 2" HEAD &&
898-
test_when_finished git notes --ref note2 remove HEAD &&
899899
900900
git config format.notes note1 &&
901901
git format-patch -1 --stdout >out &&

0 commit comments

Comments
 (0)