This test tests the behavior of 'cherry-pick -s' of a commit with an empty
commit message.

I created the test when I noticed during my series that cherry-pick was
adding a sob twice when a commit with an empty commit message was

I'm not sure we should apply this though.  I'm leaning towards saying that
the 'cherry-pick -s' behavior with respect to a commit with an empty message
body should be undefined.  If we want it to be undefined then we probably
shouldn't introduce a test which would have the effect of defining it.

Junio, if you think we should apply it, it's prepared as a fixup commit and
should autosquash easily.


 t/t3505-cherry-pick-empty.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/t/t3505-cherry-pick-empty.sh b/t/t3505-cherry-pick-empty.sh
index a0c6e30..da4c60e 100755
--- a/t/t3505-cherry-pick-empty.sh
+++ b/t/t3505-cherry-pick-empty.sh
@@ -58,6 +58,16 @@ test_expect_success 'cherry-pick a commit with an empty 
message with --allow-emp
        git cherry-pick --allow-empty-message empty-branch
+test_expect_success 'cherry-pick a commit with an empty message with 
--allow-empty-message and -s' '
+       git reset --hard HEAD^ &&
+       git cherry-pick --allow-empty-message -s empty-branch &&
+       { git show --pretty=format:%B -s empty-branch &&
+         printf "Signed-off-by: %s <%s>\n" "$GIT_COMMITTER_NAME" 
+       } >expect &&
+       git show --pretty=format:%B -s HEAD >actual &&
+       test_cmp expect actual
 test_expect_success 'cherry pick an empty non-ff commit without --allow-empty' 
        git checkout master &&
        echo fourth >>file2 &&

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

Reply via email to