replace: add test for --graft with signed commit
Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Christian Couder committed
Jul 19, 2014 at 17:01 UTC
60e2f5a5af6e605a8de48d2cd1b21c690a84ae75
1 file changed
+24
t/t6050-replace.sh
+24
@@ -7,6 +7,7 @@ test_description='Tests replace refs functionality'
7
exec </dev/null
8
9
. ./test-lib.sh
10
+. "$TEST_DIRECTORY/lib-gpg.sh"
11
12
add_and_commit_file ()
13
{
@@ -394,4 +395,27 @@ test_expect_success '--graft with and without already replaced object' '
395
git replace -d $HASH5
396
'
397
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
+
421
test_done