We are supposed to reject "--only path..." aka "a partial commit" during a conflicted merge resolution, and accept "--include path..." aka "an also commit" in such a case. Recent git (since v1.3.0) always assumes that "git commit" with paths but without --only nor --include requests the "--only" semantics, but there is a discussion that it might be a good idea to assume "--include" semantics during a merge. The last test this commit adds expects such a behaviour and marked as "expect_failure". It will be changed by the third patch in the series. Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx> --- t/t7501-commit.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-) diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh index b4e2b4d..0c10105 100755 --- a/t/t7501-commit.sh +++ b/t/t7501-commit.sh @@ -365,4 +365,48 @@ test_expect_success 'amend using the message from a commit named with tag' ' ' +test_expect_success 'setup merge commit with paths test' ' + git reset --hard && + git checkout HEAD^0 && + echo frotz >file && + test_tick && + git add file && + git commit -a -m "one side says frotz" && + git tag one-side-says-frotz && + git reset --hard HEAD^ && + echo nitfol >file && + test_tick && + git add file && + git commit -a -m "the other side says nitfol" && + git tag the-other-side-says-nitfol +' + +test_expect_success 'reject --only during a merge' ' + git checkout HEAD^0 && + git reset --hard the-other-side-says-nitfol && + test_must_fail git merge one-side-says-frotz && + echo yomin-only >file && + test_must_fail git commit -m merge --only file && + git reset --hard +' + +test_expect_success 'allow --include during a merge' ' + git checkout HEAD^0 && + git reset --hard the-other-side-says-nitfol && + test_must_fail git merge one-side-says-frotz && + echo yomin-include >file && + git commit -m merge --include file && + git reset --hard +' + +test_expect_failure 'assume --include during a merge' ' + git checkout HEAD^0 && + git reset --hard the-other-side-says-nitfol && + test_must_fail git merge one-side-says-frotz && + echo yomin-assumed >file && + git add file && + git commit -m merge file && + git reset --hard +' + test_done -- 1.6.1.265.g9a013 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html