From: Derrick Stolee via GitGitGadget <hidden> Date: 2018-09-11 20:21:08
In es/format-patch-rangediff, we added a '--range-diff' option to
git-format-patch to automatically add a range-diff. We also added an option
to write the diff as commentary to a single patch submission. However, this
check was not tested.
I discovered this test gap by running 'make coverage-test coverage-report'
on 'next' and then comparing the uncovered lines with those in the diff
between 'master' and 'next'. I have a script that automates this process,
and I'm still working on polishing it. You can see an earlier version at
[1].
Based on es/format-patch-rangediff
Cc: sunshine@sunshine.co
Cc: peff@peff.net
[1]
https://github.com/derrickstolee/git/blob/coverage/contrib/coverage-diff.shA
bash script to report uncovered lines that were added in a diff.
Derrick Stolee (1):
t3206-range-diff.sh: cover single-patch case
t/t3206-range-diff.sh | 5 +++++
1 file changed, 5 insertions(+)
base-commit: 40ce41604daf200cdc85abded0133d40faafc2f8
Published-As: https://github.com/gitgitgadget/git/releases/tags/pr-37%2Fderrickstolee%2Frange-diff-test-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-37/derrickstolee/range-diff-test-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/37
--
gitgitgadget
From: Derrick Stolee via GitGitGadget <hidden> Date: 2018-09-11 20:21:10
From: Derrick Stolee <redacted>
The commit 40ce4160 "format-patch: allow --range-diff to apply to
a lone-patch" added the ability to see a range-diff as commentary
after the commit message of a single patch series (i.e. [PATCH]
instead of [PATCH X/N]). However, this functionality was not
covered by a test case.
Add a simple test case that checks that a range-diff is written as
commentary to the patch.
Signed-off-by: Derrick Stolee <redacted>
---
t/t3206-range-diff.sh | 5 +++++
1 file changed, 5 insertions(+)
On 9/11/2018 4:21 PM, Derrick Stolee via GitGitGadget wrote:
In es/format-patch-rangediff, we added a '--range-diff' option to
git-format-patch to automatically add a range-diff. We also added an option
to write the diff as commentary to a single patch submission. However, this
check was not tested.
I discovered this test gap by running 'make coverage-test coverage-report'
on 'next' and then comparing the uncovered lines with those in the diff
between 'master' and 'next'. I have a script that automates this process,
and I'm still working on polishing it. You can see an earlier version at
[1].
Based on es/format-patch-rangediff
Cc: sunshine@sunshine.co
Cc: peff@peff.net
Sorry that these Cc's didn't work (again). Adding them manually and
investigating the GGG code.
-Stolee
From: Stefan Beller <hidden> Date: 2018-09-11 21:10:09
On Tue, Sep 11, 2018 at 1:21 PM Derrick Stolee via GitGitGadget
[off-list ref] wrote:
quoted hunk
From: Derrick Stolee <redacted>
The commit 40ce4160 "format-patch: allow --range-diff to apply to
a lone-patch" added the ability to see a range-diff as commentary
after the commit message of a single patch series (i.e. [PATCH]
instead of [PATCH X/N]). However, this functionality was not
covered by a test case.
Add a simple test case that checks that a range-diff is written as
commentary to the patch.
Signed-off-by: Derrick Stolee <redacted>
---
t/t3206-range-diff.sh | 5 +++++
1 file changed, 5 insertions(+)
@@ -154,4 +154,9 @@ do'done+test_expect_success'format-patch --range-diff as commentary''+gitformat-patch--stdout--range-diff=HEAD~1HEAD~1>actual&&
This is an interesting use of range-diff, as it basically tells us
"Range-diff: This is a new patch", but it works to make sure
there is a range diff section. (I shortly wondered if we would
ever omit the range diff for "obvious" cases or word it differently)
+ grep -A 1 -e "\-\-\-" actual | grep "Range-diff:"
So the first grep finds the three dashes, presumably those
after the commit message/ but others as well, e.g. in
--- a/<path>
+++ b/<path>
and then the second grep should find the string "Range-diff".
By having the greps chained with a pipe, only one return
code can be delivered to the test suite, and as we get the last
commands return code, we get reported if we found the string
in the preselected part.
I was wondering if we could get away with just one command to
check for that multi line pattern
sed -n -e '/---/,/^Range/p' actual
seems to detect that pattern, and prints from there on to the
rest of the file.
From: Eric Sunshine <hidden> Date: 2018-09-11 21:21:14
On Tue, Sep 11, 2018 at 4:26 PM Derrick Stolee via GitGitGadget
[off-list ref] wrote:
In es/format-patch-rangediff, we added a '--range-diff' option to
git-format-patch to automatically add a range-diff. We also added an option
to write the diff as commentary to a single patch submission. However, this
check was not tested.
It was an intentional (though unjustified) oversight. Thanks for
working on this.
I discovered this test gap by running 'make coverage-test coverage-report'
on 'next' and then comparing the uncovered lines with those in the diff
between 'master' and 'next'. I have a script that automates this process,
and I'm still working on polishing it.
Interesting. Does your script detect that the --creation-factor option
added by patch 13/14 [1] also lacks a test? (I'm not necessarily
suggesting adding a test at the moment. Even Dscho's git-range-diff
series doesn't have a test for "creation factor", so it wouldn't
necessarily make sense to add a test only for the git-format-patch
case. Instead, we'd want, at some point, to add tests covering both
git-range-diff and git-format-patch.)
[1]: https://public-inbox.org/git/20180722095717.17912-14-sunshine@sunshineco.com/
From: Eric Sunshine <hidden> Date: 2018-09-11 21:34:43
On Tue, Sep 11, 2018 at 4:26 PM Derrick Stolee via GitGitGadget
[off-list ref] wrote:
quoted hunk
The commit 40ce4160 "format-patch: allow --range-diff to apply to
a lone-patch" added the ability to see a range-diff as commentary
after the commit message of a single patch series (i.e. [PATCH]
instead of [PATCH X/N]). However, this functionality was not
covered by a test case.
Add a simple test case that checks that a range-diff is written as
commentary to the patch.
Signed-off-by: Derrick Stolee <redacted>
---
@@ -154,4 +154,9 @@ do+test_expect_success 'format-patch --range-diff as commentary' '+ git format-patch --stdout --range-diff=HEAD~1 HEAD~1 >actual &&+ grep -A 1 -e "\-\-\-" actual | grep "Range-diff:"+'
Aside from Junio's and Stefan's comments...
Patch 6/14 [1], in addition to checking that a solo patch contains an
interdiff, takes the extra step of checking that individual patches
_don't_ contain an interdiff when --cover-letter is used. I wonder if
the same should be done here, though I don't feel too strongly about
it. If you do go that route, it might make sense to move this test to
t4014 as neighbor to the --interdiff tests. The reason 10/14 [2] added
the "git format-patch --range-diff" test to t3206 instead of t4014 was
so it could do a thorough check of the embedded range-diff by re-using
the specially crafted test repo set up by t3206. Your new test is much
looser, thus could be moved alongside the --interdiff tests. Not a big
deal, though. Either way is fine. Thanks for working on this.
[1]: https://public-inbox.org/git/20180722095717.17912-7-sunshine@sunshineco.com/
[2]: https://public-inbox.org/git/20180722095717.17912-11-sunshine@sunshineco.com/
On Tue, Sep 11, 2018 at 4:26 PM Derrick Stolee via GitGitGadget
[off-list ref] wrote:
quoted
The commit 40ce4160 "format-patch: allow --range-diff to apply to
a lone-patch" added the ability to see a range-diff as commentary
after the commit message of a single patch series (i.e. [PATCH]
instead of [PATCH X/N]). However, this functionality was not
covered by a test case.
Add a simple test case that checks that a range-diff is written as
commentary to the patch.
Signed-off-by: Derrick Stolee <redacted>
---
@@ -154,4 +154,9 @@ do+test_expect_success 'format-patch --range-diff as commentary' '+ git format-patch --stdout --range-diff=HEAD~1 HEAD~1 >actual &&+ grep -A 1 -e "\-\-\-" actual | grep "Range-diff:"+'
Aside from Junio's and Stefan's comments...
Patch 6/14 [1], in addition to checking that a solo patch contains an
interdiff, takes the extra step of checking that individual patches
_don't_ contain an interdiff when --cover-letter is used. I wonder if
the same should be done here, though I don't feel too strongly about
it. If you do go that route, it might make sense to move this test to
t4014 as neighbor to the --interdiff tests. The reason 10/14 [2] added
the "git format-patch --range-diff" test to t3206 instead of t4014 was
so it could do a thorough check of the embedded range-diff by re-using
the specially crafted test repo set up by t3206. Your new test is much
looser, thus could be moved alongside the --interdiff tests. Not a big
deal, though. Either way is fine. Thanks for working on this.
[1]: https://public-inbox.org/git/20180722095717.17912-7-sunshine@sunshineco.com/
[2]: https://public-inbox.org/git/20180722095717.17912-11-sunshine@sunshineco.com/
Thanks for these links! In particular, [2] uses this line to test the
inter-diff appears:
+ test_i18ngrep "^Interdiff:$" 0001-fleep.patch &&
That's a better way to test, especially with the translation. It would
be enough for my needs.
Thanks,
-Stolee
P.S. Resending because apparently I had HTML in the last response
From: Derrick Stolee via GitGitGadget <hidden> Date: 2018-09-12 14:31:05
In es/format-patch-rangediff, we added a '--range-diff' option to
git-format-patch to automatically add a range-diff. We also added an option
to write the diff as commentary to a single patch submission. However, this
check was not tested.
I discovered this test gap by running 'make coverage-test coverage-report'
on 'next' and then comparing the uncovered lines with those in the diff
between 'master' and 'next'. I have a script that automates this process,
and I'm still working on polishing it. You can see an earlier version at
[1].
Based on es/format-patch-rangediff
Cc: sunshine@sunshine.co
Cc: peff@peff.net
[1]
https://github.com/derrickstolee/git/blob/coverage/contrib/coverage-diff.shA
bash script to report uncovered lines that were added in a diff.
Derrick Stolee (1):
t3206-range-diff.sh: cover single-patch case
t/t3206-range-diff.sh | 5 +++++
1 file changed, 5 insertions(+)
base-commit: 40ce41604daf200cdc85abded0133d40faafc2f8
Published-As: https://github.com/gitgitgadget/git/releases/tags/pr-37%2Fderrickstolee%2Frange-diff-test-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-37/derrickstolee/range-diff-test-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/37
Range-diff vs v1:
1: 58347a9624 ! 1: 277a4d2bd8 t3206-range-diff.sh: cover single-patch case
@@ -22,7 +22,7 @@
+test_expect_success 'format-patch --range-diff as commentary' '
+ git format-patch --stdout --range-diff=HEAD~1 HEAD~1 >actual &&
-+ grep -A 1 -e "\-\-\-" actual | grep "Range-diff:"
++ test_i18ngrep "^Range-diff:$" actual
+'
+
test_done
--
gitgitgadget
From: Derrick Stolee via GitGitGadget <hidden> Date: 2018-09-12 14:31:07
From: Derrick Stolee <redacted>
The commit 40ce4160 "format-patch: allow --range-diff to apply to
a lone-patch" added the ability to see a range-diff as commentary
after the commit message of a single patch series (i.e. [PATCH]
instead of [PATCH X/N]). However, this functionality was not
covered by a test case.
Add a simple test case that checks that a range-diff is written as
commentary to the patch.
Signed-off-by: Derrick Stolee <redacted>
---
t/t3206-range-diff.sh | 5 +++++
1 file changed, 5 insertions(+)