Skip to content

Commit 60e2f5a

Browse files
chriscoolgitster
authored andcommitted
replace: add test for --graft with signed commit
Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0b05ab6 commit 60e2f5a

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

t/t6050-replace.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ test_description='Tests replace refs functionality'
77
exec </dev/null
88

99
. ./test-lib.sh
10+
. "$TEST_DIRECTORY/lib-gpg.sh"
1011

1112
add_and_commit_file ()
1213
{
@@ -394,4 +395,27 @@ test_expect_success '--graft with and without already replaced object' '
394395
git replace -d $HASH5
395396
'
396397

398+
test_expect_success GPG 'set up a signed commit' '
399+
echo "line 17" >>hello &&
400+
echo "line 18" >>hello &&
401+
git add hello &&
402+
test_tick &&
403+
git commit --quiet -S -m "hello: 2 more lines in a signed commit" &&
404+
HASH8=$(git rev-parse --verify HEAD) &&
405+
git verify-commit $HASH8
406+
'
407+
408+
test_expect_success GPG '--graft with a signed commit' '
409+
git cat-file commit $HASH8 >orig &&
410+
git replace --graft $HASH8 &&
411+
git cat-file commit $HASH8 >repl &&
412+
commit_has_parents $HASH8 &&
413+
test_must_fail git verify-commit $HASH8 &&
414+
sed -n -e "/^tree /p" -e "/^author /p" -e "/^committer /p" orig >expected &&
415+
echo >>expected &&
416+
sed -e "/^$/q" repl >actual &&
417+
test_cmp expected actual &&
418+
git replace -d $HASH8
419+
'
420+
397421
test_done

0 commit comments

Comments
 (0)