@matheusbsbs / matheus-bagliano / commits / 3bdbdfb7a5
Fork 0

t3206: range-diff compares logs with commit notes

The test suite had a blindspot where it did not check the behavior of range-diff and format-patch when notes were present. Cover this blindspot. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Denton Liu committed Nov 20, 2019 at 13:18 UTC 3bdbdfb7a5a3f0077c3593cd53868cd38b569ead
1 file changed +52
t/t3206-range-diff.sh
+52
@@ -505,4 +505,56 @@ test_expect_success 'range-diff overrides diff.noprefix internally' '
505 git -c diff.noprefix=true range-diff HEAD^...
506 '
507
508 +test_expect_success 'range-diff compares notes by default' '
509 + git notes add -m "topic note" topic &&
510 + git notes add -m "unmodified note" unmodified &&
511 + test_when_finished git notes remove topic unmodified &&
512 + git range-diff --no-color master..topic master..unmodified \
513 + >actual &&
514 + sed s/Z/\ /g >expect <<-EOF &&
515 + 1: $(test_oid t1) = 1: $(test_oid u1) s/5/A/
516 + 2: $(test_oid t2) = 2: $(test_oid u2) s/4/A/
517 + 3: $(test_oid t3) = 3: $(test_oid u3) s/11/B/
518 + 4: $(test_oid t4) ! 4: $(test_oid u4) s/12/B/
519 + @@ Metadata
520 + Z
521 + Z ## Commit message ##
522 + Z s/12/B/
523 + - topic note
524 + + unmodified note
525 + Z
526 + Z ## file ##
527 + Z@@ file: A
528 + EOF
529 + test_cmp expect actual
530 +'
531 +
532 +test_expect_success 'format-patch --range-diff compares notes by default' '
533 + git notes add -m "topic note" topic &&
534 + git notes add -m "unmodified note" unmodified &&
535 + test_when_finished git notes remove topic unmodified &&
536 + git format-patch --cover-letter --range-diff=$prev \
537 + master..unmodified >actual &&
538 + test_when_finished "rm 000?-*" &&
539 + test_line_count = 5 actual &&
540 + test_i18ngrep "^Range-diff:$" 0000-* &&
541 + grep "= 1: .* s/5/A" 0000-* &&
542 + grep "= 2: .* s/4/A" 0000-* &&
543 + grep "= 3: .* s/11/B" 0000-* &&
544 + grep "! 4: .* s/12/B" 0000-* &&
545 + sed s/Z/\ /g >expect <<-EOF &&
546 + @@ Metadata
547 + Z
548 + Z ## Commit message ##
549 + Z s/12/B/
550 + - topic note
551 + + unmodified note
552 + Z
553 + Z ## file ##
554 + Z@@ file: A
555 + EOF
556 + sed "/@@ Metadata/,/@@ file: A/!d" 0000-* >actual &&
557 + test_cmp expect actual
558 +'
559 +
560 test_done