Skip to content

Commit 3bdbdfb

Browse files
Denton-Lgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 75c5aa0 commit 3bdbdfb

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

t/t3206-range-diff.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,4 +505,56 @@ test_expect_success 'range-diff overrides diff.noprefix internally' '
505505
git -c diff.noprefix=true range-diff HEAD^...
506506
'
507507

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+
508560
test_done

0 commit comments

Comments
 (0)