Skip to content

Commit 0ec8955

Browse files
LemmingAvalanchegitster
authored andcommitted
t3650: add more regression tests for failure conditions
There isn’t much test coverage for basic failure conditions. Let’s add a few more since these are simple to write and remove if they become obsolete. Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 5be4d46 commit 0ec8955

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

t/t3650-replay-basics.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,33 @@ test_expect_success '--advance with invalid commit-ish' '
6767
test_cmp expect actual
6868
'
6969

70+
test_expect_success 'option --onto or --advance is mandatory' '
71+
cat >expect <<-\EOF &&
72+
error: option --onto or --advance is mandatory
73+
EOF
74+
# First line is the error; rest is Usage
75+
test_must_fail git replay topic1..topic2 >&1 2>&1 |
76+
head -1 >actual &&
77+
test_cmp expect actual
78+
'
79+
80+
test_expect_success 'no base or negative ref gives no-replaying down to root error' '
81+
cat >expect <<-\EOF &&
82+
fatal: replaying down to root commit is not supported yet!
83+
EOF
84+
test_must_fail git replay --onto=topic1 topic2 2>actual &&
85+
test_cmp expect actual
86+
'
87+
88+
test_expect_success 'options --advance and --contained cannot be used together' '
89+
cat >expect <<-EOF &&
90+
fatal: options ${SQ}--advance${SQ} and ${SQ}--contained${SQ} cannot be used together
91+
EOF
92+
test_must_fail git replay --advance=main --contained \
93+
topic1..topic2 2>actual &&
94+
test_cmp expect actual
95+
'
96+
7097
test_expect_success 'using replay to rebase two branches, one on top of other' '
7198
git replay --ref-action=print --onto main topic1..topic2 >result &&
7299

0 commit comments

Comments
 (0)