]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t3206: range-diff compares logs with commit notes
authorDenton Liu <liu.denton@gmail.com>
Wed, 20 Nov 2019 21:18:41 +0000 (13:18 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 21 Nov 2019 00:29:52 +0000 (09:29 +0900)
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>
t/t3206-range-diff.sh

index f654aed54fe7e899c8f3ae6f58c1bbce3067dd9e..19ba6449332d2977dcf518f58653e3feaa634dd3 100755 (executable)
@@ -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