Skip to content

Commit c97268c

Browse files
committed
Merge branch 'js/rebase-i-tests'
A few tests that specifically target "git rebase -i" have been added. * js/rebase-i-tests: rebase -i: we allow extra spaces after fixup!/squash! rebase -i: demonstrate a bug with --autosquash t3404: add a test for the --gpg-sign option
2 parents 8c6d1f9 + cbcd2cb commit c97268c

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

t/t3404-rebase-interactive.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,4 +1281,12 @@ test_expect_success 'editor saves as CR/LF' '
12811281
)
12821282
'
12831283

1284+
SQ="'"
1285+
test_expect_success 'rebase -i --gpg-sign=<key-id>' '
1286+
set_fake_editor &&
1287+
FAKE_LINES="edit 1" git rebase -i --gpg-sign="\"S I Gner\"" HEAD^ \
1288+
>out 2>err &&
1289+
grep "$SQ-S\"S I Gner\"$SQ" err
1290+
'
1291+
12841292
test_done

t/t3415-rebase-autosquash.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,4 +271,37 @@ test_expect_success 'autosquash with custom inst format' '
271271
test 2 = $(git cat-file commit HEAD^ | grep squash | wc -l)
272272
'
273273

274+
set_backup_editor () {
275+
write_script backup-editor.sh <<-\EOF
276+
cp "$1" .git/backup-"$(basename "$1")"
277+
EOF
278+
test_set_editor "$PWD/backup-editor.sh"
279+
}
280+
281+
test_expect_failure 'autosquash with multiple empty patches' '
282+
test_tick &&
283+
git commit --allow-empty -m "empty" &&
284+
test_tick &&
285+
git commit --allow-empty -m "empty2" &&
286+
test_tick &&
287+
>fixup &&
288+
git add fixup &&
289+
git commit --fixup HEAD^^ &&
290+
(
291+
set_backup_editor &&
292+
GIT_USE_REBASE_HELPER=false \
293+
git rebase -i --force-rebase --autosquash HEAD~4 &&
294+
grep empty2 .git/backup-git-rebase-todo
295+
)
296+
'
297+
298+
test_expect_success 'extra spaces after fixup!' '
299+
base=$(git rev-parse HEAD) &&
300+
test_commit to-fixup &&
301+
git commit --allow-empty -m "fixup! to-fixup" &&
302+
git rebase -i --autosquash --keep-empty HEAD~2 &&
303+
parent=$(git rev-parse HEAD^) &&
304+
test $base = $parent
305+
'
306+
274307
test_done

0 commit comments

Comments
 (0)