Skip to content

Commit

Permalink
t3206: range-diff compares logs with commit notes
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Denton-L authored and gitster committed Nov 21, 2019
1 parent 75c5aa0 commit 3bdbdfb
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions t/t3206-range-diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -505,4 +505,56 @@ test_expect_success 'range-diff overrides diff.noprefix internally' '
git -c diff.noprefix=true range-diff HEAD^...
'

test_expect_success 'range-diff compares notes by default' '
git notes add -m "topic note" topic &&
git notes add -m "unmodified note" unmodified &&
test_when_finished git notes remove topic unmodified &&
git range-diff --no-color master..topic master..unmodified \
>actual &&
sed s/Z/\ /g >expect <<-EOF &&
1: $(test_oid t1) = 1: $(test_oid u1) s/5/A/
2: $(test_oid t2) = 2: $(test_oid u2) s/4/A/
3: $(test_oid t3) = 3: $(test_oid u3) s/11/B/
4: $(test_oid t4) ! 4: $(test_oid u4) s/12/B/
@@ Metadata
Z
Z ## Commit message ##
Z s/12/B/
- topic note
+ unmodified note
Z
Z ## file ##
Z@@ file: A
EOF
test_cmp expect actual
'

test_expect_success 'format-patch --range-diff compares notes by default' '
git notes add -m "topic note" topic &&
git notes add -m "unmodified note" unmodified &&
test_when_finished git notes remove topic unmodified &&
git format-patch --cover-letter --range-diff=$prev \
master..unmodified >actual &&
test_when_finished "rm 000?-*" &&
test_line_count = 5 actual &&
test_i18ngrep "^Range-diff:$" 0000-* &&
grep "= 1: .* s/5/A" 0000-* &&
grep "= 2: .* s/4/A" 0000-* &&
grep "= 3: .* s/11/B" 0000-* &&
grep "! 4: .* s/12/B" 0000-* &&
sed s/Z/\ /g >expect <<-EOF &&
@@ Metadata
Z
Z ## Commit message ##
Z s/12/B/
- topic note
+ unmodified note
Z
Z ## file ##
Z@@ file: A
EOF
sed "/@@ Metadata/,/@@ file: A/!d" 0000-* >actual &&
test_cmp expect actual
'

test_done

0 comments on commit 3bdbdfb

Please sign in to comment.