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>
This commit is contained in:
Denton Liu 2019-11-20 13:18:41 -08:00 коммит произвёл Junio C Hamano
Родитель 75c5aa0701
Коммит 3bdbdfb7a5
1 изменённых файлов: 52 добавлений и 0 удалений

Просмотреть файл

@ -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