Re: [PATCH v2 03/10] t/t3511: add some tests of 'cherry-pick -s' functionality
Brandon Casey wrote: I'll tweak the string so it looks like this: The signed-off-by string should begin with the words Signed-off-by followed by a colon and space, and then the signers name and email address. e.g. Signed-off-by: $GIT_COMMITTER_NAME $GIT_COMMITTER_EMAIL Yep, that looks better than the example I suggested. :) [...] On Tue, Jan 22, 2013 at 12:17 AM, Jonathan Nieder jrnie...@gmail.com wrote: One more test would be interesting: what does -s do when asked to produce a duplicate signoff with an interspersed signoff by someone else? [...] This one exists as adds sob when last sob doesn't match committer. So it does. Thanks for the sanity check. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 03/10] t/t3511: add some tests of 'cherry-pick -s' functionality
On Tue, Jan 22, 2013 at 12:17 AM, Jonathan Nieder jrnie...@gmail.com wrote: Brandon Casey wrote: --- /dev/null +++ b/t/t3511-cherry-pick-x.sh [...] +test_expect_failure 'cherry-pick -s inserts blank line after non-conforming footer' ' IIUC this is an illustration of false-positives from messages like this one: base: do something great without a sign-off If he does that, it will be the best thing in the world: or so I think. A worthy cause. Could the example broken message be tweaked to emphasize that use case? With the current example, I'd consider either result (blank line or no blank line) to be ok behavior by git. The primary motivation for this test was to exercise an existing behavior which fails to append a newline and sob if the last line of the last paragraph matches the sob of the committer regardless of whether the entire paragraph would be interpreted as a conforming footer. Your example is tested as a side-effect of that. I'll tweak the string so it looks like this: The signed-off-by string should begin with the words Signed-off-by followed by a colon and space, and then the signers name and email address. e.g. Signed-off-by: $GIT_COMMITTER_NAME $GIT_COMMITTER_EMAIL [...] +test_expect_success 'cherry-pick -s refrains from adding duplicate trailing sob' ' And the other side of basic -s functionality. One more test would be interesting: what does -s do when asked to produce a duplicate signoff with an interspersed signoff by someone else? test: a patch with a more complicated life This patch bounced from $GIT_COMMITTER_NAME to Ms. Thor for tweaking, then back to $GIT_COMMITTER_NAME who will be recording it in permanent history. Signed-off-by: $GIT_COMMITTER_NAME $GIT_COMMITTER_EMAIL Signed-off-by: A U Thor aut...@example.com This one exists as adds sob when last sob doesn't match committer. In this case an additional sob should be appended to the footer. -Brandon -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 03/10] t/t3511: add some tests of 'cherry-pick -s' functionality
Brandon Casey wrote: --- /dev/null +++ b/t/t3511-cherry-pick-x.sh @@ -0,0 +1,111 @@ [...] + test_commit $mesg_one_line foo b mesg-one-line + git reset --hard initial + test_commit $mesg_no_footer foo b mesg-no-footer + git reset --hard initial + test_commit $mesg_broken_footer foo b mesg-broken-footer + git reset --hard initial + test_commit $mesg_with_footer foo b mesg-with-footer + git reset --hard initial + test_commit $mesg_with_footer_sob foo b mesg-with-footer-sob Neat. [...] +test_expect_success 'cherry-pick -s inserts blank line after one line subject' ' In particular, a blank line after a one-line subject that starts with the usual subsystem: convention is not mistaken for an RFC2822-style header. Good. [...] +test_expect_failure 'cherry-pick -s inserts blank line after non-conforming footer' ' IIUC this is an illustration of false-positives from messages like this one: base: do something great without a sign-off If he does that, it will be the best thing in the world: or so I think. A worthy cause. Could the example broken message be tweaked to emphasize that use case? With the current example, I'd consider either result (blank line or no blank line) to be ok behavior by git. [...] +test_expect_success 'cherry-pick -s inserts blank line when conforming footer not found' ' This is a simpler version of the previous test, without the distracting colon. [...] +test_expect_success 'cherry-pick -s adds sob when last sob doesnt match committer' ' Nice test for basic -s functionality. [...] +test_expect_success 'cherry-pick -s refrains from adding duplicate trailing sob' ' And the other side of basic -s functionality. One more test would be interesting: what does -s do when asked to produce a duplicate signoff with an interspersed signoff by someone else? test: a patch with a more complicated life This patch bounced from $GIT_COMMITTER_NAME to Ms. Thor for tweaking, then back to $GIT_COMMITTER_NAME who will be recording it in permanent history. Signed-off-by: $GIT_COMMITTER_NAME $GIT_COMMITTER_EMAIL Signed-off-by: A U Thor aut...@example.com With the changes suggested above or similar ones, Reviewed-by: Jonathan Nieder jrnie...@gmail.com -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 03/10] t/t3511: add some tests of 'cherry-pick -s' functionality
Add some tests to ensure that 'cherry-pick -s' operates in the following manner: * Inserts a blank line before appending a s-o-b to a commit message that does not contain a s-o-b footer * Does not mistake first line subject: description as a s-o-b footer * Does not mistake single word message body as conforming to rfc2822 * Appends a s-o-b when last s-o-b in footer does not match committer s-o-b, even when committer's s-o-b exists elsewhere in footer. * Does not append a s-o-b when last s-o-b matches committer s-o-b * Correctly detects a non-conforming footer containing a mix of s-o-b like elements and s-o-b elements. (marked expect failure) Signed-off-by: Brandon Casey bca...@nvidia.com --- t/t3511-cherry-pick-x.sh | 111 +++ 1 file changed, 111 insertions(+) create mode 100755 t/t3511-cherry-pick-x.sh diff --git a/t/t3511-cherry-pick-x.sh b/t/t3511-cherry-pick-x.sh new file mode 100755 index 000..a6c4168 --- /dev/null +++ b/t/t3511-cherry-pick-x.sh @@ -0,0 +1,111 @@ +#!/bin/sh + +test_description='Test cherry-pick -x and -s' + +. ./test-lib.sh + +pristine_detach () { + git cherry-pick --quit + git checkout -f $1^0 + git read-tree -u --reset HEAD + git clean -d -f -f -q -x +} + +mesg_one_line='base: commit message' + +mesg_no_footer=$mesg_one_line + +OneWordBodyThatsNotA-S-o-B + +mesg_with_footer=$mesg_no_footer + +Signed-off-by: $GIT_COMMITTER_NAME $GIT_COMMITTER_EMAIL +Signed-off-by: A.U. Thor aut...@example.com +Signed-off-by: B.U. Thor but...@example.com + +mesg_broken_footer=$mesg_no_footer + +Signed-off-by: B.U. Thor but...@example.com +Not a valid footer element +Signed-off-by: $GIT_COMMITTER_NAME $GIT_COMMITTER_EMAIL + +mesg_with_footer_sob=$mesg_with_footer +Signed-off-by: $GIT_COMMITTER_NAME $GIT_COMMITTER_EMAIL + + +test_expect_success setup ' + git config advice.detachedhead false + echo unrelated unrelated + git add unrelated + test_commit initial foo a + test_commit $mesg_one_line foo b mesg-one-line + git reset --hard initial + test_commit $mesg_no_footer foo b mesg-no-footer + git reset --hard initial + test_commit $mesg_broken_footer foo b mesg-broken-footer + git reset --hard initial + test_commit $mesg_with_footer foo b mesg-with-footer + git reset --hard initial + test_commit $mesg_with_footer_sob foo b mesg-with-footer-sob + pristine_detach initial + test_commit conflicting unrelated +' + +test_expect_success 'cherry-pick -s inserts blank line after one line subject' ' + pristine_detach initial + git cherry-pick -s mesg-one-line + cat -EOF expect + $mesg_one_line + + Signed-off-by: $GIT_COMMITTER_NAME $GIT_COMMITTER_EMAIL + EOF + git log -1 --pretty=format:%B actual + test_cmp expect actual +' + +test_expect_failure 'cherry-pick -s inserts blank line after non-conforming footer' ' + pristine_detach initial + git cherry-pick -s mesg-broken-footer + cat -EOF expect + $mesg_broken_footer + + Signed-off-by: $GIT_COMMITTER_NAME $GIT_COMMITTER_EMAIL + EOF + git log -1 --pretty=format:%B actual + test_cmp expect actual +' + +test_expect_success 'cherry-pick -s inserts blank line when conforming footer not found' ' + pristine_detach initial + git cherry-pick -s mesg-no-footer + cat -EOF expect + $mesg_no_footer + + Signed-off-by: $GIT_COMMITTER_NAME $GIT_COMMITTER_EMAIL + EOF + git log -1 --pretty=format:%B actual + test_cmp expect actual +' + +test_expect_success 'cherry-pick -s adds sob when last sob doesnt match committer' ' + pristine_detach initial + git cherry-pick -s mesg-with-footer + cat -EOF expect + $mesg_with_footer + Signed-off-by: $GIT_COMMITTER_NAME $GIT_COMMITTER_EMAIL + EOF + git log -1 --pretty=format:%B actual + test_cmp expect actual +' + +test_expect_success 'cherry-pick -s refrains from adding duplicate trailing sob' ' + pristine_detach initial + git cherry-pick -s mesg-with-footer-sob + cat -EOF expect + $mesg_with_footer_sob + EOF + git log -1 --pretty=format:%B actual + test_cmp expect actual +' + +test_done -- 1.8.1.1.252.gdb33759 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html