From patchwork Fri Oct 23 16:01:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 11853801 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 132F3C5517A for ; Fri, 23 Oct 2020 16:01:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 978B721D47 for ; Fri, 23 Oct 2020 16:01:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="d79G2PE3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751207AbgJWQBa (ORCPT ); Fri, 23 Oct 2020 12:01:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S374473AbgJWQBa (ORCPT ); Fri, 23 Oct 2020 12:01:30 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1A09C0613CE for ; Fri, 23 Oct 2020 09:01:28 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id v5so2065667wmh.1 for ; Fri, 23 Oct 2020 09:01:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=+4pzEOn6w6jQ6sdQrGNEWI8FMsBnpvBysrp79Vdxqw8=; b=d79G2PE3p+ObjE9ltWnkGkWiTtbCiLDzxqsFYuyGZjq5rQ+yn/+FWGidlc2d/kpTHm 3ePFjwCx2o4a82ACXsy3+z6Xp2rs4ORiB3ZJpI8pYkS+t+NS5sms0UJPXpdwu7hDWU0D H4NEvGesUfEUA0Z5474TDZxlZUbXUPeBgIeiFbvCfBSTHobtGjthgmUGVKzz5qwk8PJf Pp97AzEUwq8qElbBHPTYjQgW59ZJcPPriK+jv2A3S6B7+0CcpP1vsbMPIiSFyVn+/ndj iHN5o6p0KTivo0LtGTSGfDqf/VZ0usd51o5xR5kHna70GwCk6YlGyjYezCLzKma0pzZ6 0KzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=+4pzEOn6w6jQ6sdQrGNEWI8FMsBnpvBysrp79Vdxqw8=; b=k9u2hlOJw5vJVPk2+HjyRHQtoYsUP6Kcm0rudb0kC5D1hPZJ1SfOFWvcI1knR4PyE/ kjsFioCtPW/md2g7zwLMhib8I7qMQM/3eK9gBW1aZdj9NqCQcGdO3KEM/DCM9+mpnZbC kL3wO6FurFrqrQXtnMoUTAAd3Ieupmfz7aUElq5++LdiaemJs3WNqaFtQIAFR18KtvxF 4C4UpSApHmx0LE8Kdv8U3h6phlTR7WXRqdLciOE/9f/xB6K0YnZ91rZEJ3KOF1HGwtUQ 3rDT91HkuDMa1cnnK2oI7YS9nGODcjohkkoqbbVq/KmhpchDefC2aNkZXIwMDXArOEp5 oxDA== X-Gm-Message-State: AOAM5328MzAu1oxaTT4jc4yv3Ef8sM3HYWayEQFxEYSrWdgOgEMUUo4U Vpe9OEyZ/0Vgr9gu1iFSrBXjY6FaLgI= X-Google-Smtp-Source: ABdhPJyK9Wdk7vazK2U4YjNOh2BWK462vJie4a7lRTszKgnibOMaV0SiBbmbjc8D9CtF4fdcq2lUrQ== X-Received: by 2002:a1c:9a93:: with SMTP id c141mr3242089wme.168.1603468887084; Fri, 23 Oct 2020 09:01:27 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id s2sm4526114wmf.45.2020.10.23.09.01.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Oct 2020 09:01:26 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Fri, 23 Oct 2020 16:01:16 +0000 Subject: [PATCH 1/9] t/: new helper for tests that pass with ort but fail with recursive Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren There are a number of tests that the "recursive" backend does not handle correctly but which the redesign in "ort" will. Add a new helper in lib-merge.sh for selecting a different test expectation based on the setting of GIT_TEST_MERGE_ALGORITHM, and use it in various testcases to document which ones we expect to fail under recursive but pass under ort. Signed-off-by: Elijah Newren Signed-off-by: Đoàn Trần Công Danh --- t/lib-merge.sh | 15 +++++++++++++++ t/t6416-recursive-corner-cases.sh | 11 ++++++----- t/t6422-merge-rename-corner-cases.sh | 7 ++++--- t/t6423-merge-rename-directories.sh | 13 +++++++------ t/t6426-merge-skip-unneeded-updates.sh | 3 ++- t/t6430-merge-recursive.sh | 3 ++- 6 files changed, 36 insertions(+), 16 deletions(-) create mode 100644 t/lib-merge.sh diff --git a/t/lib-merge.sh b/t/lib-merge.sh new file mode 100644 index 0000000000..fac2bc5919 --- /dev/null +++ b/t/lib-merge.sh @@ -0,0 +1,15 @@ +# Helper functions used by merge tests. + +test_expect_merge_algorithm () { + status_for_recursive=$1 + shift + status_for_ort=$1 + shift + + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test_expect_${status_for_ort} "$@" + else + test_expect_${status_for_recursive} "$@" + fi +} diff --git a/t/t6416-recursive-corner-cases.sh b/t/t6416-recursive-corner-cases.sh index fd98989b14..8b3a4fc843 100755 --- a/t/t6416-recursive-corner-cases.sh +++ b/t/t6416-recursive-corner-cases.sh @@ -3,6 +3,7 @@ test_description='recursive merge corner cases involving criss-cross merges' . ./test-lib.sh +. "$TEST_DIRECTORY"/lib-merge.sh # # L1 L2 @@ -1069,7 +1070,7 @@ test_expect_success 'setup symlink modify/modify' ' ) ' -test_expect_failure 'check symlink modify/modify' ' +test_expect_merge_algorithm failure success 'check symlink modify/modify' ' ( cd symlink-modify-modify && @@ -1135,7 +1136,7 @@ test_expect_success 'setup symlink add/add' ' ) ' -test_expect_failure 'check symlink add/add' ' +test_expect_merge_algorithm failure success 'check symlink add/add' ' ( cd symlink-add-add && @@ -1223,7 +1224,7 @@ test_expect_success 'setup submodule modify/modify' ' ) ' -test_expect_failure 'check submodule modify/modify' ' +test_expect_merge_algorithm failure success 'check submodule modify/modify' ' ( cd submodule-modify-modify && @@ -1311,7 +1312,7 @@ test_expect_success 'setup submodule add/add' ' ) ' -test_expect_failure 'check submodule add/add' ' +test_expect_merge_algorithm failure success 'check submodule add/add' ' ( cd submodule-add-add && @@ -1386,7 +1387,7 @@ test_expect_success 'setup conflicting entry types (submodule vs symlink)' ' ) ' -test_expect_failure 'check conflicting entry types (submodule vs symlink)' ' +test_expect_merge_algorithm failure success 'check conflicting entry types (submodule vs symlink)' ' ( cd submodule-symlink-add-add && diff --git a/t/t6422-merge-rename-corner-cases.sh b/t/t6422-merge-rename-corner-cases.sh index 3375eaf4e7..58729593ba 100755 --- a/t/t6422-merge-rename-corner-cases.sh +++ b/t/t6422-merge-rename-corner-cases.sh @@ -4,6 +4,7 @@ test_description="recursive merge corner cases w/ renames but not criss-crosses" # t6036 has corner cases that involve both criss-cross merges and renames . ./test-lib.sh +. "$TEST_DIRECTORY"/lib-merge.sh test_setup_rename_delete_untracked () { test_create_repo rename-delete-untracked && @@ -878,7 +879,7 @@ test_setup_rad () { ) } -test_expect_failure 'rad-check: rename/add/delete conflict' ' +test_expect_merge_algorithm failure success 'rad-check: rename/add/delete conflict' ' test_setup_rad && ( cd rad && @@ -951,7 +952,7 @@ test_setup_rrdd () { ) } -test_expect_failure 'rrdd-check: rename/rename(2to1)/delete/delete conflict' ' +test_expect_merge_algorithm failure success 'rrdd-check: rename/rename(2to1)/delete/delete conflict' ' test_setup_rrdd && ( cd rrdd && @@ -1040,7 +1041,7 @@ test_setup_mod6 () { ) } -test_expect_failure 'mod6-check: chains of rename/rename(1to2) and rename/rename(2to1)' ' +test_expect_merge_algorithm failure success 'mod6-check: chains of rename/rename(1to2) and rename/rename(2to1)' ' test_setup_mod6 && ( cd mod6 && diff --git a/t/t6423-merge-rename-directories.sh b/t/t6423-merge-rename-directories.sh index 06b46af765..807a424a52 100755 --- a/t/t6423-merge-rename-directories.sh +++ b/t/t6423-merge-rename-directories.sh @@ -26,6 +26,7 @@ test_description="recursive merge with directory renames" # files that might be renamed into each other's paths.) . ./test-lib.sh +. "$TEST_DIRECTORY"/lib-merge.sh ########################################################################### @@ -1339,7 +1340,7 @@ test_setup_6b1 () { ) } -test_expect_failure '6b1: Same renames done on both sides, plus another rename' ' +test_expect_merge_algorithm failure success '6b1: Same renames done on both sides, plus another rename' ' test_setup_6b1 && ( cd 6b1 && @@ -1412,7 +1413,7 @@ test_setup_6b2 () { ) } -test_expect_failure '6b2: Same rename done on both sides' ' +test_expect_merge_algorithm failure success '6b2: Same rename done on both sides' ' test_setup_6b2 && ( cd 6b2 && @@ -3471,7 +3472,7 @@ test_setup_10e () { ) } -test_expect_failure '10e: Does git complain about untracked file that is not really in the way?' ' +test_expect_merge_algorithm failure success '10e: Does git complain about untracked file that is not really in the way?' ' test_setup_10e && ( cd 10e && @@ -4104,7 +4105,7 @@ test_setup_12b1 () { ) } -test_expect_failure '12b1: Moving two directory hierarchies into each other' ' +test_expect_merge_algorithm failure success '12b1: Moving two directory hierarchies into each other' ' test_setup_12b1 && ( cd 12b1 && @@ -4272,7 +4273,7 @@ test_setup_12c1 () { ) } -test_expect_failure '12c1: Moving one directory hierarchy into another w/ content merge' ' +test_expect_merge_algorithm failure success '12c1: Moving one directory hierarchy into another w/ content merge' ' test_setup_12c1 && ( cd 12c1 && @@ -4632,7 +4633,7 @@ test_setup_12f () { ) } -test_expect_failure '12f: Trivial directory resolve, caching, all kinds of fun' ' +test_expect_merge_algorithm failure success '12f: Trivial directory resolve, caching, all kinds of fun' ' test_setup_12f && ( cd 12f && diff --git a/t/t6426-merge-skip-unneeded-updates.sh b/t/t6426-merge-skip-unneeded-updates.sh index 699813671c..d7eeee4310 100755 --- a/t/t6426-merge-skip-unneeded-updates.sh +++ b/t/t6426-merge-skip-unneeded-updates.sh @@ -23,6 +23,7 @@ test_description="merge cases" # files that might be renamed into each other's paths.) . ./test-lib.sh +. "$TEST_DIRECTORY"/lib-merge.sh ########################################################################### @@ -666,7 +667,7 @@ test_setup_4a () { # correct requires doing the merge in-memory first, then realizing that no # updates to the file are necessary, and thus that we can just leave the path # alone. -test_expect_failure '4a: Change on A, change on B subset of A, dirty mods present' ' +test_expect_merge_algorithm failure success '4a: Change on A, change on B subset of A, dirty mods present' ' test_setup_4a && ( cd 4a && diff --git a/t/t6430-merge-recursive.sh b/t/t6430-merge-recursive.sh index a328260d42..9c08e63af2 100755 --- a/t/t6430-merge-recursive.sh +++ b/t/t6430-merge-recursive.sh @@ -3,6 +3,7 @@ test_description='merge-recursive backend test' . ./test-lib.sh +. "$TEST_DIRECTORY"/lib-merge.sh test_expect_success 'setup 1' ' @@ -641,7 +642,7 @@ test_expect_success 'merge-recursive copy vs. rename' ' test_cmp expected actual ' -test_expect_failure 'merge-recursive rename vs. rename/symlink' ' +test_expect_merge_algorithm failure success 'merge-recursive rename vs. rename/symlink' ' git checkout -f rename && git merge rename-ln && From patchwork Fri Oct 23 16:01:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 11853809 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 511E9C55179 for ; Fri, 23 Oct 2020 16:01:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C524921D47 for ; Fri, 23 Oct 2020 16:01:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="agkw6HiF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751209AbgJWQBb (ORCPT ); Fri, 23 Oct 2020 12:01:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S464808AbgJWQBa (ORCPT ); Fri, 23 Oct 2020 12:01:30 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16DB2C0613D2 for ; Fri, 23 Oct 2020 09:01:30 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id s9so2469219wro.8 for ; Fri, 23 Oct 2020 09:01:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=7yt+yRyOLDBn/1W1vYjwIwKEYGvE1UbR4AYeCBJ5bbE=; b=agkw6HiFYnBNddLmF/7VGqXb7SAvZsKUpxlDQTmCNaCHSVWeTKie1CrT1fGvF6xvx/ 5O0MhfbJdWxiGztax0EgDt8g6Z6N8H/GP1itegoDpzBguWUnmQnKW7Tpp+0zceiMpL54 /HRpoI8NtGPR04v2xdriuc1Jg22BHzLD1bb7Y9Hr0Nbw7//e6HBM0j6hLu0H2MABL5Ut rsfX0egmkakRdbYgi92Nox6W6srwg4vYKScPMjH4JTA8EVQgbha+QlBoaOiyo7H1BMrK Lo1xbPlnzFVPam9CZpoK2QmjvV7hJ1mmjIkJnsz05EtPf8WG+ILq3gPNIj6ZQtR6wwiO hl/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=7yt+yRyOLDBn/1W1vYjwIwKEYGvE1UbR4AYeCBJ5bbE=; b=OMv0P+Kh1/hjR3YxHpI44p6L7jY/mo9pc3A5RnkONWPoL7y6HzNTDWVmfXFYd6cimu CPLMDgL4QOtLr2rCuATk51TAb7hcxR6l+tU1y23eE3ore1Ol44dMC8/WG196rLDs05AL BgjgwrOXNxA+zENDVf9jEWz3BLEUWtRR/GVjMmonLXFoaXZOY9XFmSPZANL49hmRk9L9 Q92oIT3hacKLzLnQcqHevdsRpi1tATrB7APxiLVVbCYB3I2hqmC9Ee1TTjU2lXXx4G5U SWQSPOPcyqTd0y4kTg9h4Fgc94QGD0vEdNe7GyCet8hexk+rRbbKtpICwJCKYKMXMwDf bDgQ== X-Gm-Message-State: AOAM533djfWQq9TgX3z3PB3iI0nu0mGO6edIOEUDP9kNw1E1JaLfVT9C A3ljWr6CrUfoKjNd5aJ72BGU784Ref0= X-Google-Smtp-Source: ABdhPJzbF74+0Pd1gb5EcpIAI6tfXfSBe1lqOLQ9fxZhVKVi1rebq4chMDVD96u9zydkEZl2pyOH2Q== X-Received: by 2002:a5d:5604:: with SMTP id l4mr3239356wrv.140.1603468887931; Fri, 23 Oct 2020 09:01:27 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id b136sm3684306wmb.21.2020.10.23.09.01.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Oct 2020 09:01:27 -0700 (PDT) Message-Id: <9394d526f1425fcf6b8865b53b737ba81c11dd80.1603468885.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 23 Oct 2020 16:01:17 +0000 Subject: [PATCH 2/9] merge tests: expect improved directory/file conflict handling in ort Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren merge-recursive.c is built on the idea of running unpack_trees() and then "doing minor touch-ups" to get the result. Unfortunately, unpack_trees() was run in an update-as-it-goes mode, leading merge-recursive.c to follow suit and end up with an immediate evaluation and fix-it-up-as-you-go design. Some things like directory/file conflicts are not well representable in the index data structure, and required special extra code to handle. But then when it was discovered that rename/delete conflicts could also be involved in directory/file conflicts, the special directory/file conflict handling code had to be copied to the rename/delete codepath. ...and then it had to be copied for modify/delete, and for rename/rename(1to2) conflicts, ...and yet it still missed some. Further, when it was discovered that there were also file/submodule conflicts and submodule/directory conflicts, we needed to copy the special submodule handling code to all the special cases throughout the codebase. And then it was discovered that our handling of directory/file conflicts was suboptimal because it would create untracked files to store the contents of the conflicting file, which would not be cleaned up if someone were to run a 'git merge --abort' or 'git rebase --abort'. It was also difficult or scary to try to add or remove the index entries corresponding to these files given the directory/file conflict in the index. But changing merge-recursive.c to handle these correctly was a royal pain because there were so many sites in the code with similar but not identical code for handling directory/file/submodule conflicts that would all need to be updated. I have worked hard to push all directory/file/submodule conflict handling in merge-ort through a single codepath, and avoid creating untracked files for storing tracked content (it does record things at alternate paths, but makes sure they have higher-order stages in the index). Since updating merge-recursive is too much work and we don't want to destabilize it, instead update the testsuite to have different expectations for relevant directory/file/submodule conflict tests. Signed-off-by: Elijah Newren --- t/t6400-merge-df.sh | 14 +- t/t6402-merge-rename.sh | 108 ++++++++++++---- t/t6416-recursive-corner-cases.sh | 185 +++++++++++++++++++-------- t/t6422-merge-rename-corner-cases.sh | 30 +++-- t/t6423-merge-rename-directories.sh | 53 +++++--- t/t7610-mergetool.sh | 32 ++++- 6 files changed, 314 insertions(+), 108 deletions(-) diff --git a/t/t6400-merge-df.sh b/t/t6400-merge-df.sh index f1b84617af..9da0838216 100755 --- a/t/t6400-merge-df.sh +++ b/t/t6400-merge-df.sh @@ -81,7 +81,12 @@ test_expect_success 'modify/delete + directory/file conflict' ' test 5 -eq $(git ls-files -s | wc -l) && test 4 -eq $(git ls-files -u | wc -l) && - test 1 -eq $(git ls-files -o | wc -l) && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test 0 -eq $(git ls-files -o | wc -l) + else + test 1 -eq $(git ls-files -o | wc -l) + fi && test_path_is_file letters/file && test_path_is_file letters.txt && @@ -97,7 +102,12 @@ test_expect_success 'modify/delete + directory/file conflict; other way' ' test 5 -eq $(git ls-files -s | wc -l) && test 4 -eq $(git ls-files -u | wc -l) && - test 1 -eq $(git ls-files -o | wc -l) && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test 0 -eq $(git ls-files -o | wc -l) + else + test 1 -eq $(git ls-files -o | wc -l) + fi && test_path_is_file letters/file && test_path_is_file letters.txt && diff --git a/t/t6402-merge-rename.sh b/t/t6402-merge-rename.sh index bbbba3dcbf..47d4434d64 100755 --- a/t/t6402-merge-rename.sh +++ b/t/t6402-merge-rename.sh @@ -397,7 +397,12 @@ test_expect_success 'Rename+D/F conflict; renamed file cannot merge and dir in t test_must_fail git merge --strategy=recursive dir-in-way && test 5 -eq "$(git ls-files -u | wc -l)" && - test 3 -eq "$(git ls-files -u dir | grep -v file-in-the-way | wc -l)" && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test 3 -eq "$(git ls-files -u dir~HEAD | wc -l)" + else + test 3 -eq "$(git ls-files -u dir | grep -v file-in-the-way | wc -l)" + fi && test 2 -eq "$(git ls-files -u dir/file-in-the-way | wc -l)" && test_must_fail git diff --quiet && @@ -415,7 +420,12 @@ test_expect_success 'Same as previous, but merged other way' ' test_must_fail git merge --strategy=recursive renamed-file-has-conflicts && test 5 -eq "$(git ls-files -u | wc -l)" && - test 3 -eq "$(git ls-files -u dir | grep -v file-in-the-way | wc -l)" && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test 3 -eq "$(git ls-files -u dir~renamed-file-has-conflicts | wc -l)" + else + test 3 -eq "$(git ls-files -u dir | grep -v file-in-the-way | wc -l)" + fi && test 2 -eq "$(git ls-files -u dir/file-in-the-way | wc -l)" && test_must_fail git diff --quiet && @@ -471,7 +481,12 @@ test_expect_success 'both rename source and destination involved in D/F conflict git checkout -q rename-dest^0 && test_must_fail git merge --strategy=recursive source-conflict && - test 1 -eq "$(git ls-files -u | wc -l)" && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test 2 -eq "$(git ls-files -u | wc -l)" + else + test 1 -eq "$(git ls-files -u | wc -l)" + fi && test_must_fail git diff --quiet && @@ -505,34 +520,63 @@ test_expect_success 'setup pair rename to parent of other (D/F conflicts)' ' git commit -m "Rename one/file -> two" ' -test_expect_success 'pair rename to parent of other (D/F conflicts) w/ untracked dir' ' - git checkout -q rename-one^0 && - mkdir one && - test_must_fail git merge --strategy=recursive rename-two && +if test "$GIT_TEST_MERGE_ALGORITHM" = ort +then + test_expect_success 'pair rename to parent of other (D/F conflicts) w/ untracked dir' ' + git checkout -q rename-one^0 && + mkdir one && + test_must_fail git merge --strategy=recursive rename-two && - test 2 -eq "$(git ls-files -u | wc -l)" && - test 1 -eq "$(git ls-files -u one | wc -l)" && - test 1 -eq "$(git ls-files -u two | wc -l)" && + test 4 -eq "$(git ls-files -u | wc -l)" && + test 2 -eq "$(git ls-files -u one | wc -l)" && + test 2 -eq "$(git ls-files -u two | wc -l)" && - test_must_fail git diff --quiet && + test_must_fail git diff --quiet && - test 4 -eq $(find . | grep -v .git | wc -l) && + test 3 -eq $(find . | grep -v .git | wc -l) && - test_path_is_dir one && - test_path_is_file one~rename-two && - test_path_is_file two && - test "other" = $(cat one~rename-two) && - test "stuff" = $(cat two) -' + test_path_is_file one && + test_path_is_file two && + test "other" = $(cat one) && + test "stuff" = $(cat two) + ' +else + test_expect_success 'pair rename to parent of other (D/F conflicts) w/ untracked dir' ' + git checkout -q rename-one^0 && + mkdir one && + test_must_fail git merge --strategy=recursive rename-two && + + test 2 -eq "$(git ls-files -u | wc -l)" && + test 1 -eq "$(git ls-files -u one | wc -l)" && + test 1 -eq "$(git ls-files -u two | wc -l)" && + + test_must_fail git diff --quiet && + + test 4 -eq $(find . | grep -v .git | wc -l) && + + test_path_is_dir one && + test_path_is_file one~rename-two && + test_path_is_file two && + test "other" = $(cat one~rename-two) && + test "stuff" = $(cat two) + ' +fi test_expect_success 'pair rename to parent of other (D/F conflicts) w/ clean start' ' git reset --hard && git clean -fdqx && test_must_fail git merge --strategy=recursive rename-two && - test 2 -eq "$(git ls-files -u | wc -l)" && - test 1 -eq "$(git ls-files -u one | wc -l)" && - test 1 -eq "$(git ls-files -u two | wc -l)" && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test 4 -eq "$(git ls-files -u | wc -l)" && + test 2 -eq "$(git ls-files -u one | wc -l)" && + test 2 -eq "$(git ls-files -u two | wc -l)" + else + test 2 -eq "$(git ls-files -u | wc -l)" && + test 1 -eq "$(git ls-files -u one | wc -l)" && + test 1 -eq "$(git ls-files -u two | wc -l)" + fi && test_must_fail git diff --quiet && @@ -572,12 +616,22 @@ test_expect_success 'check handling of differently renamed file with D/F conflic git checkout -q first-rename^0 && test_must_fail git merge --strategy=recursive second-rename && - test 5 -eq "$(git ls-files -s | wc -l)" && - test 3 -eq "$(git ls-files -u | wc -l)" && - test 1 -eq "$(git ls-files -u one | wc -l)" && - test 1 -eq "$(git ls-files -u two | wc -l)" && - test 1 -eq "$(git ls-files -u original | wc -l)" && - test 2 -eq "$(git ls-files -o | wc -l)" && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test 5 -eq "$(git ls-files -s | wc -l)" && + test 3 -eq "$(git ls-files -u | wc -l)" && + test 1 -eq "$(git ls-files -u one~HEAD | wc -l)" && + test 1 -eq "$(git ls-files -u two~second-rename | wc -l)" && + test 1 -eq "$(git ls-files -u original | wc -l)" && + test 0 -eq "$(git ls-files -o | wc -l)" + else + test 5 -eq "$(git ls-files -s | wc -l)" && + test 3 -eq "$(git ls-files -u | wc -l)" && + test 1 -eq "$(git ls-files -u one | wc -l)" && + test 1 -eq "$(git ls-files -u two | wc -l)" && + test 1 -eq "$(git ls-files -u original | wc -l)" && + test 2 -eq "$(git ls-files -o | wc -l)" + fi && test_path_is_file one/file && test_path_is_file two/file && diff --git a/t/t6416-recursive-corner-cases.sh b/t/t6416-recursive-corner-cases.sh index 8b3a4fc843..0317e83970 100755 --- a/t/t6416-recursive-corner-cases.sh +++ b/t/t6416-recursive-corner-cases.sh @@ -538,9 +538,15 @@ test_expect_success 'setup differently handled merges of directory/file conflict git checkout B^0 && test_must_fail git merge C^0 && - git clean -fd && - git rm -rf a/ && - git rm a && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + git rm -rf a/ && + git rm a~HEAD + else + git clean -fd && + git rm -rf a/ && + git rm a + fi && git cat-file -p B:a >a2 && git add a2 && git commit -m D2 && @@ -559,7 +565,12 @@ test_expect_success 'setup differently handled merges of directory/file conflict git checkout C^0 && test_must_fail git merge B^0 && - git clean -fd && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + git rm a~B^0 + else + git clean -fd + fi && git rm -rf a/ && test_write_lines 1 2 3 4 5 6 7 8 >a && git add a && @@ -568,9 +579,15 @@ test_expect_success 'setup differently handled merges of directory/file conflict git checkout C^0 && test_must_fail git merge B^0 && - git clean -fd && - git rm -rf a/ && - git rm a && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + git rm -rf a/ && + git rm a~B^0 + else + git clean -fd && + git rm -rf a/ && + git rm a + fi && test_write_lines 1 2 3 4 5 6 7 8 >a2 && git add a2 && git commit -m E4 && @@ -588,18 +605,34 @@ test_expect_success 'merge of D1 & E1 fails but has appropriate contents' ' test_must_fail git merge -s recursive E1^0 && - git ls-files -s >out && - test_line_count = 2 out && - git ls-files -u >out && - test_line_count = 1 out && - git ls-files -o >out && - test_line_count = 1 out && - - git rev-parse >expect \ - A:ignore-me B:a && - git rev-parse >actual \ - :0:ignore-me :2:a && - test_cmp expect actual + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + git ls-files -s >out && + test_line_count = 3 out && + git ls-files -u >out && + test_line_count = 2 out && + git ls-files -o >out && + test_line_count = 1 out && + + git rev-parse >expect \ + A:ignore-me B:a D1:a && + git rev-parse >actual \ + :0:ignore-me :1:a :2:a && + test_cmp expect actual + else + git ls-files -s >out && + test_line_count = 2 out && + git ls-files -u >out && + test_line_count = 1 out && + git ls-files -o >out && + test_line_count = 1 out && + + git rev-parse >expect \ + A:ignore-me B:a && + git rev-parse >actual \ + :0:ignore-me :2:a && + test_cmp expect actual + fi ) ' @@ -613,18 +646,34 @@ test_expect_success 'merge of E1 & D1 fails but has appropriate contents' ' test_must_fail git merge -s recursive D1^0 && - git ls-files -s >out && - test_line_count = 2 out && - git ls-files -u >out && - test_line_count = 1 out && - git ls-files -o >out && - test_line_count = 1 out && - - git rev-parse >expect \ - A:ignore-me B:a && - git rev-parse >actual \ - :0:ignore-me :3:a && - test_cmp expect actual + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + git ls-files -s >out && + test_line_count = 3 out && + git ls-files -u >out && + test_line_count = 2 out && + git ls-files -o >out && + test_line_count = 1 out && + + git rev-parse >expect \ + A:ignore-me B:a D1:a && + git rev-parse >actual \ + :0:ignore-me :1:a :3:a && + test_cmp expect actual + else + git ls-files -s >out && + test_line_count = 2 out && + git ls-files -u >out && + test_line_count = 1 out && + git ls-files -o >out && + test_line_count = 1 out && + + git rev-parse >expect \ + A:ignore-me B:a && + git rev-parse >actual \ + :0:ignore-me :3:a && + test_cmp expect actual + fi ) ' @@ -638,17 +687,32 @@ test_expect_success 'merge of D1 & E2 fails but has appropriate contents' ' test_must_fail git merge -s recursive E2^0 && - git ls-files -s >out && - test_line_count = 4 out && - git ls-files -u >out && - test_line_count = 3 out && - git ls-files -o >out && - test_line_count = 2 out && - - git rev-parse >expect \ - B:a E2:a/file C:a/file A:ignore-me && - git rev-parse >actual \ - :2:a :3:a/file :1:a/file :0:ignore-me && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + git ls-files -s >out && + test_line_count = 5 out && + git ls-files -u >out && + test_line_count = 4 out && + git ls-files -o >out && + test_line_count = 1 out && + + git rev-parse >expect \ + B:a D1:a E2:a/file C:a/file A:ignore-me && + git rev-parse >actual \ + :1:a~HEAD :2:a~HEAD :3:a/file :1:a/file :0:ignore-me + else + git ls-files -s >out && + test_line_count = 4 out && + git ls-files -u >out && + test_line_count = 3 out && + git ls-files -o >out && + test_line_count = 2 out && + + git rev-parse >expect \ + B:a E2:a/file C:a/file A:ignore-me && + git rev-parse >actual \ + :2:a :3:a/file :1:a/file :0:ignore-me + fi && test_cmp expect actual && test_path_is_file a~HEAD @@ -665,17 +729,32 @@ test_expect_success 'merge of E2 & D1 fails but has appropriate contents' ' test_must_fail git merge -s recursive D1^0 && - git ls-files -s >out && - test_line_count = 4 out && - git ls-files -u >out && - test_line_count = 3 out && - git ls-files -o >out && - test_line_count = 2 out && - - git rev-parse >expect \ - B:a E2:a/file C:a/file A:ignore-me && - git rev-parse >actual \ - :3:a :2:a/file :1:a/file :0:ignore-me && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + git ls-files -s >out && + test_line_count = 5 out && + git ls-files -u >out && + test_line_count = 4 out && + git ls-files -o >out && + test_line_count = 1 out && + + git rev-parse >expect \ + B:a D1:a E2:a/file C:a/file A:ignore-me && + git rev-parse >actual \ + :1:a~D1^0 :3:a~D1^0 :2:a/file :1:a/file :0:ignore-me + else + git ls-files -s >out && + test_line_count = 4 out && + git ls-files -u >out && + test_line_count = 3 out && + git ls-files -o >out && + test_line_count = 2 out && + + git rev-parse >expect \ + B:a E2:a/file C:a/file A:ignore-me && + git rev-parse >actual \ + :3:a :2:a/file :1:a/file :0:ignore-me + fi && test_cmp expect actual && test_path_is_file a~D1^0 diff --git a/t/t6422-merge-rename-corner-cases.sh b/t/t6422-merge-rename-corner-cases.sh index 58729593ba..78bfaf17f0 100755 --- a/t/t6422-merge-rename-corner-cases.sh +++ b/t/t6422-merge-rename-corner-cases.sh @@ -313,15 +313,18 @@ test_expect_success 'rename/directory conflict + clean content merge' ' git ls-files -u >out && test_line_count = 1 out && git ls-files -o >out && - test_line_count = 2 out && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test_line_count = 1 out + else + test_line_count = 2 out + fi && echo 0 >expect && git cat-file -p base:file >>expect && echo 7 >>expect && test_cmp expect newfile~HEAD && - test $(git rev-parse :2:newfile) = $(git hash-object expect) && - test_path_is_file newfile/realfile && test_path_is_file newfile~HEAD ) @@ -344,7 +347,12 @@ test_expect_success 'rename/directory conflict + content merge conflict' ' git ls-files -u >out && test_line_count = 3 out && git ls-files -o >out && - test_line_count = 2 out && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test_line_count = 1 out + else + test_line_count = 2 out + fi && git cat-file -p left-conflict:newfile >left && git cat-file -p base:file >base && @@ -356,10 +364,16 @@ test_expect_success 'rename/directory conflict + content merge conflict' ' left base right && test_cmp left newfile~HEAD && - git rev-parse >expect \ - base:file left-conflict:newfile right:file && - git rev-parse >actual \ - :1:newfile :2:newfile :3:newfile && + git rev-parse >expect \ + base:file left-conflict:newfile right:file && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + git rev-parse >actual \ + :1:newfile~HEAD :2:newfile~HEAD :3:newfile~HEAD + else + git rev-parse >actual \ + :1:newfile :2:newfile :3:newfile + fi && test_cmp expect actual && test_path_is_file newfile/realfile && diff --git a/t/t6423-merge-rename-directories.sh b/t/t6423-merge-rename-directories.sh index 807a424a52..5ea77564d7 100755 --- a/t/t6423-merge-rename-directories.sh +++ b/t/t6423-merge-rename-directories.sh @@ -1177,10 +1177,18 @@ test_expect_success '5d: Directory/file/file conflict due to directory rename' ' git ls-files -u >out && test_line_count = 1 out && git ls-files -o >out && - test_line_count = 2 out && - - git rev-parse >actual \ - :0:y/b :0:y/c :0:z/d :0:y/f :2:y/d :0:y/d/e && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test_line_count = 1 out && + + git rev-parse >actual \ + :0:y/b :0:y/c :0:z/d :0:y/f :2:y/d~HEAD :0:y/d/e + else + test_line_count = 2 out && + + git rev-parse >actual \ + :0:y/b :0:y/c :0:z/d :0:y/f :2:y/d :0:y/d/e + fi && git rev-parse >expect \ O:z/b O:z/c B:z/d B:z/f A:y/d B:y/d/e && test_cmp expect actual && @@ -2017,17 +2025,32 @@ test_expect_success '7e: transitive rename in rename/delete AND dirs in the way' test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out && test_i18ngrep "CONFLICT (rename/delete).*x/d.*y/d" out && - git ls-files -s >out && - test_line_count = 5 out && - git ls-files -u >out && - test_line_count = 1 out && - git ls-files -o >out && - test_line_count = 2 out && - - git rev-parse >actual \ - :0:x/d/f :0:y/d/g :0:y/b :0:y/c :3:y/d && - git rev-parse >expect \ - A:x/d/f A:y/d/g O:z/b O:z/c O:x/d && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + git ls-files -s >out && + test_line_count = 6 out && + git ls-files -u >out && + test_line_count = 2 out && + git ls-files -o >out && + test_line_count = 1 out && + + git rev-parse >actual \ + :0:x/d/f :0:y/d/g :0:y/b :0:y/c :1:y/d~B^0 :3:y/d~B^0 && + git rev-parse >expect \ + A:x/d/f A:y/d/g O:z/b O:z/c O:x/d O:x/d + else + git ls-files -s >out && + test_line_count = 5 out && + git ls-files -u >out && + test_line_count = 1 out && + git ls-files -o >out && + test_line_count = 2 out && + + git rev-parse >actual \ + :0:x/d/f :0:y/d/g :0:y/b :0:y/c :3:y/d && + git rev-parse >expect \ + A:x/d/f A:y/d/g O:z/b O:z/c O:x/d + fi && test_cmp expect actual && git hash-object y/d~B^0 >actual && diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh index ad288ddc69..70afdd06fa 100755 --- a/t/t7610-mergetool.sh +++ b/t/t7610-mergetool.sh @@ -532,7 +532,14 @@ test_expect_success 'file vs modified submodule' ' yes "" | git mergetool file1 file2 spaced\ name subdir/file3 && yes "" | git mergetool both && yes "d" | git mergetool file11 file12 && - yes "l" | git mergetool submod && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + yes "c" | git mergetool submod~HEAD && + git rm submod && + git mv submod~HEAD submod + else + yes "l" | git mergetool submod + fi && git submodule update -N && echo "not a submodule" >expect && test_cmp expect submod && @@ -549,7 +556,15 @@ test_expect_success 'file vs modified submodule' ' yes "" | git mergetool file1 file2 spaced\ name subdir/file3 && yes "" | git mergetool both && yes "d" | git mergetool file11 file12 && - yes "r" | git mergetool submod && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + mv submod submod.orig && + git rm --cached submod && + yes "c" | git mergetool submod~test19 && + git mv submod~test19 submod + else + yes "r" | git mergetool submod + fi && test -d submod.orig && git submodule update -N && echo "not a submodule" >expect && @@ -567,6 +582,10 @@ test_expect_success 'file vs modified submodule' ' yes "" | git mergetool both && yes "d" | git mergetool file11 file12 && yes "l" | git mergetool submod && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + yes "d" | git mergetool submod~test19 + fi && echo "master submodule" >expect && test_cmp expect submod/bar && git submodule update -N && @@ -664,7 +683,14 @@ test_expect_success 'directory vs modified submodule' ' test_must_fail git merge master && test -n "$(git ls-files -u)" && test ! -e submod.orig && - yes "r" | git mergetool submod && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + yes "r" | git mergetool submod~master && + git mv submod submod.orig && + git mv submod~master submod + else + yes "r" | git mergetool submod + fi && test -d submod.orig && echo "not a submodule" >expect && test_cmp expect submod.orig/file16 && From patchwork Fri Oct 23 16:01:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 11853805 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE608C56201 for ; Fri, 23 Oct 2020 16:01:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 68C2421D47 for ; Fri, 23 Oct 2020 16:01:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BijItXtc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751212AbgJWQBc (ORCPT ); Fri, 23 Oct 2020 12:01:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S464808AbgJWQBb (ORCPT ); Fri, 23 Oct 2020 12:01:31 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31409C0613D4 for ; Fri, 23 Oct 2020 09:01:30 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id x7so2504603wrl.3 for ; Fri, 23 Oct 2020 09:01:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=LOsRglWXY+n9K3CRFstIO+D5wM+7Jv2UbOBcy+4tIHA=; b=BijItXtcQ1kPmtBVINzymAiCIEkHSTt78Gw6VltrUNmhcBt7MfEgZUCxrTLzhjKgbE /41/L/PyA5nCnZ0PhmOMCOCZptXpyyK3uz+nbeLXVpDx1ADHYE/bMfJ0YNQR+mIoqC4v a2ztQHvGah/3jVOIboCjFW31U/UwI5tiXGAwQzw3GJlqfSZbU3CzZxYJhHnTDY48Y/Cq UdyV8VzSrXXlHX5ok1ZJW/1d7rcWme/Xx8hsUwjLOX595ONborZ2h728ItJvquD72XBA bFauFvGx95gn1Co+byVWitMBmPAHVKMXRAZh89L8mZFb/dIFUBHit+UaNyaauE5M+37t 4qiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=LOsRglWXY+n9K3CRFstIO+D5wM+7Jv2UbOBcy+4tIHA=; b=WVqMfS5+BlCERFVnngm/v8CDnnYLf/sM0VT4YFKBPs56DIb6OtIFjf9jpCy5iIBJcv 70cBwAGOkJKwXbA9S2KWMfJZ+p4SltUATrtSp9/g4ZCkPe/Ze0c/yg8iXVwylLDUSeo0 LCKv0wFq9ABMAVfx6kdQTGrQNJJ8ZVpqg7LZ0pZ0pKfl1vbvafm2gXMcUe06F1b34HrB 1Znuwm+3UasHoLXEg2bV3QZK/QCsT/jOQ3nmxpCJRtDKi1wfMSPVrtxgihBd4WVkxpug QA61xIx9LNY0YHZ6/cqPmXdZ4Boh1rGugu98k1B6Ga+UzzzKjaBuXCfRLFqpImdeziTZ ZIxA== X-Gm-Message-State: AOAM530dQwGJ7Sg/qFNp3pDs8Q7rwevT9QJjQD/93UdeOtM3qYYC8X+A wdJEsY8ZoaNETYpJJxJURfOzTgQF61w= X-Google-Smtp-Source: ABdhPJwrP3KcxLmcQi2m03FOeB5l4Uqt1f4L3YgQOdRQBTO4ttfolDTnpllUx9DfOjhPRiFlhWh7cw== X-Received: by 2002:a5d:5086:: with SMTP id a6mr3287610wrt.283.1603468888698; Fri, 23 Oct 2020 09:01:28 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id p9sm4156187wmm.4.2020.10.23.09.01.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Oct 2020 09:01:28 -0700 (PDT) Message-Id: <1eae84b7878dc6ebe7ee1fb4e860c316cd773ad5.1603468885.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 23 Oct 2020 16:01:18 +0000 Subject: [PATCH 3/9] t6416: correct expectation for rename/rename(1to2) + directory/file Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren When files are renamed and modified, we need to do three-way content merges to get the appropriate content in the right location. When we have a rename/rename(1to2) conflict (both sides rename the same file, but differently), that merged content should be placed in each of the two resulting files. merge-recursive handled that fine when that was all that was involved, but when one or more of the two resulting files were ALSO involved in a directory/file conflict, it failed to propagate the merged content to that file. Unfortunately, the one test in t6416 that touched on this combination of cases had been coded to not expect the merged contents to be present. Fix the test to check for the right behavior, and record how the different merge backends will be expected to handle it. Signed-off-by: Elijah Newren --- t/t6416-recursive-corner-cases.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t6416-recursive-corner-cases.sh b/t/t6416-recursive-corner-cases.sh index 0317e83970..887c2195a9 100755 --- a/t/t6416-recursive-corner-cases.sh +++ b/t/t6416-recursive-corner-cases.sh @@ -786,7 +786,7 @@ test_expect_success 'merge of D1 & E3 succeeds' ' ) ' -test_expect_success 'merge of D1 & E4 notifies user a and a2 are related' ' +test_expect_merge_algorithm failure success 'merge of D1 & E4 puts merge of a and a2 in both a and a2' ' test_when_finished "git -C directory-file reset --hard" && test_when_finished "git -C directory-file clean -fdqx" && ( @@ -804,7 +804,7 @@ test_expect_success 'merge of D1 & E4 notifies user a and a2 are related' ' test_line_count = 1 out && git rev-parse >expect \ - A:ignore-me B:a D1:a E4:a2 && + A:ignore-me B:a E4:a2 E4:a2 && git rev-parse >actual \ :0:ignore-me :1:a~Temporary\ merge\ branch\ 2 :2:a :3:a2 && test_cmp expect actual From patchwork Fri Oct 23 16:01:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 11853811 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E538C388F9 for ; Fri, 23 Oct 2020 16:01:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F029921D47 for ; Fri, 23 Oct 2020 16:01:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iZfRIibC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751215AbgJWQBh (ORCPT ); Fri, 23 Oct 2020 12:01:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S464808AbgJWQBg (ORCPT ); Fri, 23 Oct 2020 12:01:36 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53B46C0613CE for ; Fri, 23 Oct 2020 09:01:36 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id j7so2469973wrt.9 for ; Fri, 23 Oct 2020 09:01:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=xTh0/ZwZW6Ma8rEW81J5QgP6ZpGakFVaDbdYOH/CrOM=; b=iZfRIibCjadzxVHkbms8ZSYBQdmLx0Fb3MHsaDZKLdwK1C4/xxMJK2MBk97wvVomip XqmkfGuMz8DqpMnQJyC7bT1udmsvsOpRtGL3KvPMMxaXochw20sTePEpUPLOnH+y3bZy uyhMGZxlzvYlydxnsc+rDQH+hE6EzkIvHPR3Qx+dsMy2IiQYZKauZCDttPMel/iHn8HW q0XaUHnMIyRFlH5yObIMwKZ0SuN2euTTuYp0Vaugf6qNgvLuEqyNl9vTpJstRpT+xVLZ 2btXthFc19gPuHl3mc18QsWLHxcOtPc4C3Nd2VPWJ9CxMEFYtIKuEYZBPseChUcpXAwo 2KJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=xTh0/ZwZW6Ma8rEW81J5QgP6ZpGakFVaDbdYOH/CrOM=; b=FL3PFDl2ORWXEA88cov4Vxsu/FGic7IwIVHmgwngPn7EEQBQtgkC749iUBQcQA+rnQ rsLk47KzAk2jFN5k+8rx4EmvXICJvI6TFRj6rIERpDMbBHQZHLQEmNsqDBJyUdCczKa7 XVU9NTDQXvctJP5cGaXsExFGtDg9D+WKdIhiC5L/lOQSsI4JX8sRc5w44qQwLz21Nwy2 BYVu1sXyAVnx8szN/itpcsVky60V2bsSKsYpgahCjsc6hCAMAyZB8tEhRfqUjCvabOu/ gJYMVJNEHR55BA/RpACK6Biir4E0qGU+f9vi0rNEgHZ8U2FxfgHqqXKV65KNSj/d74ii 28ZQ== X-Gm-Message-State: AOAM531Ri9Z2O8j+gwuwDavbAmB/4mJX/0urJCCvckbXZQd0miTjFOhI kk8fIuVzw5TXxXKmy6OCXEYxF6vr85s= X-Google-Smtp-Source: ABdhPJxThrAnXzkGcpQSHQHCfUnCoQrvpsuJz2Bn2+IZmShmeg4YZiuhpiKy5Se6VHlhpm9KXn2okg== X-Received: by 2002:adf:8484:: with SMTP id 4mr3486591wrg.334.1603468889648; Fri, 23 Oct 2020 09:01:29 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id a185sm3878492wmf.24.2020.10.23.09.01.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Oct 2020 09:01:29 -0700 (PDT) Message-Id: <554feb2aa734367bd9fcd4dd63726c985514be2a.1603468885.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 23 Oct 2020 16:01:19 +0000 Subject: [PATCH 4/9] t6404, t6423: expect improved rename/delete handling in ort backend Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren When a file is renamed and has content conflicts, merge-recursive does not have some stages for the old filename and some stages for the new filename in the index; instead it copies all the stages corresponding to the old filename over to the corresponding locations for the new filename, so that there are three higher order stages all corresponding to the new filename. Doing things this way makes it easier for the user to access the different versions and to resolve the conflict (no need to manually 'git rm' the old version as well as 'git add' the new one). rename/deletes should be handled similarly -- there should be two stages for the renamed file rather than just one. We do not want to destabilize merge-recursive right now, so instead update relevant tests to have different expectations depending on whether the "recursive" or "ort" merge strategies are in use. Signed-off-by: Elijah Newren --- t/t6404-recursive-merge.sh | 14 +++++- t/t6423-merge-rename-directories.sh | 70 ++++++++++++++++++++--------- 2 files changed, 62 insertions(+), 22 deletions(-) diff --git a/t/t6404-recursive-merge.sh b/t/t6404-recursive-merge.sh index 332cfc53fd..b1c3d4dda4 100755 --- a/t/t6404-recursive-merge.sh +++ b/t/t6404-recursive-merge.sh @@ -118,12 +118,22 @@ test_expect_success 'mark rename/delete as unmerged' ' test_tick && git commit -m rename && test_must_fail git merge delete && - test 1 = $(git ls-files --unmerged | wc -l) && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test 2 = $(git ls-files --unmerged | wc -l) + else + test 1 = $(git ls-files --unmerged | wc -l) + fi && git rev-parse --verify :2:a2 && test_must_fail git rev-parse --verify :3:a2 && git checkout -f delete && test_must_fail git merge rename && - test 1 = $(git ls-files --unmerged | wc -l) && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test 2 = $(git ls-files --unmerged | wc -l) + else + test 1 = $(git ls-files --unmerged | wc -l) + fi && test_must_fail git rev-parse --verify :2:a2 && git rev-parse --verify :3:a2 ' diff --git a/t/t6423-merge-rename-directories.sh b/t/t6423-merge-rename-directories.sh index 5ea77564d7..f9a3f24039 100755 --- a/t/t6423-merge-rename-directories.sh +++ b/t/t6423-merge-rename-directories.sh @@ -1271,17 +1271,32 @@ test_expect_success '6a: Tricky rename/delete' ' test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out && test_i18ngrep "CONFLICT (rename/delete).*z/c.*y/c" out && - git ls-files -s >out && - test_line_count = 2 out && - git ls-files -u >out && - test_line_count = 1 out && - git ls-files -o >out && - test_line_count = 1 out && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + git ls-files -s >out && + test_line_count = 3 out && + git ls-files -u >out && + test_line_count = 2 out && + git ls-files -o >out && + test_line_count = 1 out && - git rev-parse >actual \ - :0:y/b :3:y/c && - git rev-parse >expect \ - O:z/b O:z/c && + git rev-parse >actual \ + :0:y/b :1:y/c :3:y/c && + git rev-parse >expect \ + O:z/b O:z/c O:z/c + else + git ls-files -s >out && + test_line_count = 2 out && + git ls-files -u >out && + test_line_count = 1 out && + git ls-files -o >out && + test_line_count = 1 out && + + git rev-parse >actual \ + :0:y/b :3:y/c && + git rev-parse >expect \ + O:z/b O:z/c + fi && test_cmp expect actual ) ' @@ -1934,17 +1949,32 @@ test_expect_success '7d: transitive rename involved in rename/delete; how is it test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out && test_i18ngrep "CONFLICT (rename/delete).*x/d.*y/d" out && - git ls-files -s >out && - test_line_count = 3 out && - git ls-files -u >out && - test_line_count = 1 out && - git ls-files -o >out && - test_line_count = 1 out && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + git ls-files -s >out && + test_line_count = 4 out && + git ls-files -u >out && + test_line_count = 2 out && + git ls-files -o >out && + test_line_count = 1 out && - git rev-parse >actual \ - :0:y/b :0:y/c :3:y/d && - git rev-parse >expect \ - O:z/b O:z/c O:x/d && + git rev-parse >actual \ + :0:y/b :0:y/c :1:y/d :3:y/d && + git rev-parse >expect \ + O:z/b O:z/c O:x/d O:x/d + else + git ls-files -s >out && + test_line_count = 3 out && + git ls-files -u >out && + test_line_count = 1 out && + git ls-files -o >out && + test_line_count = 1 out && + + git rev-parse >actual \ + :0:y/b :0:y/c :3:y/d && + git rev-parse >expect \ + O:z/b O:z/c O:x/d + fi && test_cmp expect actual ) ' From patchwork Fri Oct 23 16:01:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 11853803 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFA13C55179 for ; Fri, 23 Oct 2020 16:01:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6E53921D47 for ; Fri, 23 Oct 2020 16:01:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QVQoOsRc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751217AbgJWQBi (ORCPT ); Fri, 23 Oct 2020 12:01:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S464808AbgJWQBh (ORCPT ); Fri, 23 Oct 2020 12:01:37 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28454C0613CE for ; Fri, 23 Oct 2020 09:01:37 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id n6so2463591wrm.13 for ; Fri, 23 Oct 2020 09:01:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=dm3ZWdoKJ4fCc1YirGC9Oa6AR/FNVWe6XQ3HESMkBuY=; b=QVQoOsRcdka+kNIlJC2ExAYA/SCYCU5u8+i83rKD9+sAbw+mcgeq6xUGBBfd3xstVF k+3aWi8YDibQp949j2/2tpxvp36lebYQtEW9xNPKIYjRZe55EaRGQuYCHqAQQYg7Wvdp yApW025zbpD6ePuPPvpGjs2h0qebTNQIUfcHrmmaBoWHxcPZgPJ2cWr8Bso2lT2AD8bF IyWDOCpLnXR55okDyjdF8eCXppcQ9DWwggjktO11oOpeNID+LFM8t5za8lKAteD97U0O ZTItQ8ZQ2zjiGM7TEESK1xPPr8k11nMq1lsuy+EVLCuUkbU+Lhqals2Onhy90JYR2Elw 0WjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=dm3ZWdoKJ4fCc1YirGC9Oa6AR/FNVWe6XQ3HESMkBuY=; b=J4iHSOfHvolUqVy5wqBJCmt3ja1iC4O2A5G01zpEPbdZmwY7fqzJW5HEDTyo4Cm5KC CPnHyDOX+93+ilELnUavuP14b7FwlUI+ka9bG40XotBIyXpVFAapEUMO9w5yEplDaWMO yONJGoC9S10HokZbEYe0RK7ngfW3umU7JklTJSdF1Haukop2tZjaB4DeYBikOWZ+Mnbg vjMwBdZJOe5rGnGvd7tcFi0uUXqOG0pd6kopZXcsTCnn568wyF3ptwEoUJ7uRd281HVr hHvdnGPbLYN8jZl6UTTt9yMB9/jAoLvrU9qaCEIfwl2/hhtroMUKzZ8lsCERRyCQE6eg fYkQ== X-Gm-Message-State: AOAM533Zsjuw5iipVp0A2mdWdyMBp8CYs0twMcM4rRq0d5WRu3j0fJFc denUtKvgOJZ3EOwWKceMr14G2wB734g= X-Google-Smtp-Source: ABdhPJzG7aeZw3vpCm2vthHwS1tVa2SEiSYrUKMqpUdnTlsTZTBFNr5mDO3xGccSBrI4RqUrmzrE3w== X-Received: by 2002:a5d:4b10:: with SMTP id v16mr3587923wrq.178.1603468895746; Fri, 23 Oct 2020 09:01:35 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id b7sm4194291wrp.16.2020.10.23.09.01.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Oct 2020 09:01:35 -0700 (PDT) Message-Id: <5bead7fa0d8d11f9587818e49b3e867f64e5a7b7.1603468885.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 23 Oct 2020 16:01:20 +0000 Subject: [PATCH 5/9] t6423: expect improved conflict markers labels in the ort backend Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Conflict markers carry an extra annotation of the form REF-OR-COMMIT:FILENAME to help distinguish where the content is coming from, with the :FILENAME piece being left off if it is the same for both sides of history (thus only renames with content conflicts carry that part of the annotation). However, there were cases where the :FILENAME annotation was accidentally left off, due to merge-recursive's every-codepath-needs-a-copy-of-all-special-case-code format. Update a few tests to have the correct :FILENAME extension on relevant paths with the ort backend, while leaving the expectation for merge-recursive the same to avoid destabilizing it. Signed-off-by: Elijah Newren --- t/t6423-merge-rename-directories.sh | 38 +++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/t/t6423-merge-rename-directories.sh b/t/t6423-merge-rename-directories.sh index f9a3f24039..7e32626913 100755 --- a/t/t6423-merge-rename-directories.sh +++ b/t/t6423-merge-rename-directories.sh @@ -302,11 +302,20 @@ test_expect_success '1d: Directory renames cause a rename/rename(2to1) conflict' git cat-file -p :2:x/wham >expect && git cat-file -p :3:x/wham >other && >empty && - test_must_fail git merge-file \ - -L "HEAD" \ - -L "" \ - -L "B^0" \ - expect empty other && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test_must_fail git merge-file \ + -L "HEAD:y/wham" \ + -L "" \ + -L "B^0:z/wham" \ + expect empty other + else + test_must_fail git merge-file \ + -L "HEAD" \ + -L "" \ + -L "B^0" \ + expect empty other + fi && test_cmp expect x/wham ) ' @@ -1823,11 +1832,20 @@ test_expect_success '7b: rename/rename(2to1), but only due to transitive rename' git cat-file -p :2:y/d >expect && git cat-file -p :3:y/d >other && >empty && - test_must_fail git merge-file \ - -L "HEAD" \ - -L "" \ - -L "B^0" \ - expect empty other && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test_must_fail git merge-file \ + -L "HEAD:y/d" \ + -L "" \ + -L "B^0:z/d" \ + expect empty other + else + test_must_fail git merge-file \ + -L "HEAD" \ + -L "" \ + -L "B^0" \ + expect empty other + fi && test_cmp expect y/d ) ' From patchwork Fri Oct 23 16:01:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 11853815 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F361EC4363A for ; Fri, 23 Oct 2020 16:01:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A1DCA21D47 for ; Fri, 23 Oct 2020 16:01:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UkgESMl5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751219AbgJWQBk (ORCPT ); Fri, 23 Oct 2020 12:01:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S460371AbgJWQBj (ORCPT ); Fri, 23 Oct 2020 12:01:39 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 264C7C0613CE for ; Fri, 23 Oct 2020 09:01:38 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id n6so2463680wrm.13 for ; Fri, 23 Oct 2020 09:01:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=HaRwDLTydUy7FLPVpRuFefJ2uY7gfvz15ejRfMX1vHE=; b=UkgESMl5nBHqaF8zBv8Qv5DhTUmaj/5cdrrpF2Hf60aWfmdoKvJTGNulSZCjBku5Ym ubO8VkWKaQGQmmzIccjzTJjLYP0AcAilMr/5aTPTAvN/VewwtM/NYNrqeM4m3F2CZD1c LiHtLKhGvrTSMNNROK4qdBLwKXm6ynkXanF5F4RLDePw4nMZhuiRDDtD2jE/zFL0rIPs TWAAqR+muNfjU4Rj6nwLt0cstFrZUKFAkG8pwxTmt0RxVd/Kt3CmJeFSk9R0mVRaxZ4g wHHxu4yguQzYCfbfSS0YNLLsKwt9QYfevuTKvYzOfdoeRTjJ6zqu/oBlnRJD/QJk8x2g AfpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=HaRwDLTydUy7FLPVpRuFefJ2uY7gfvz15ejRfMX1vHE=; b=Tm8TjjqVYxqY6bWMWqi0N4o4wVn7x48oQKCYAj3W9UVi6QMiDsvC6NnOepewzbkObF yofG0KW3YAMEnfB/dlEiX1/zTsNEqIVEVYTl5mnGdLrSr7x3F3c+JPbRLdRQsR2aYQ3Y Kj0XPyrHwy57Z4qlZDgCMO6L8w8tOVJeqe9LM3Ixv97/a1VQ49GiIkN0ja4I+pE80zU2 U/YK27H4SIzQUfJViZU3R6nM2JeGH3h3kg1eTh6X18QarhdrLSXCidZDeDh6/CkASQHb kTbRKsOawUivehqaU0RwtR5CclyE8AbWEGUs/f5dZH9tX5CztpF6mwanzqe70zzFjFvN BiVw== X-Gm-Message-State: AOAM5324fYqNB01dOa6yz4peOHrazm9Lz9MBWsYlCw1v+QZ2y9G+rw5m hFpLUtyhckgM8Dtjjrg+wWUz7/VsIk0= X-Google-Smtp-Source: ABdhPJzB1lqKPxF9X2Ke/3AorrljGhX8V0KM7w+IYWj32BY3WAqM1E8bs3r+MUILNGEY1cGRZMfH9Q== X-Received: by 2002:a5d:678a:: with SMTP id v10mr3358506wru.307.1603468896649; Fri, 23 Oct 2020 09:01:36 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id x18sm4513548wrg.4.2020.10.23.09.01.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Oct 2020 09:01:36 -0700 (PDT) Message-Id: <2aa44c1f13ac1fd70167770f7749611eadc396d4.1603468885.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 23 Oct 2020 16:01:21 +0000 Subject: [PATCH 6/9] merge tests: expect slight differences in output for recursive vs. ort Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren The ort merge strategy has some slight differences in commit descriptions (shortened hashes), stdout vs stderr, and in conflict messages. Also, builtin/merge.c reports usage of "ort" as "Merge made by the 'ort' strategy" -- while it is meant as a drop in replacement for "recursive" it is not yet treated as though it is recursive. Update the testcases to expect different output for the different merge backends. Signed-off-by: Elijah Newren --- t/t6402-merge-rename.sh | 14 ++++++++++++-- t/t6437-submodule-merge.sh | 25 +++++++++++++++++++++---- t/t7602-merge-octopus-many.sh | 4 ++++ 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/t/t6402-merge-rename.sh b/t/t6402-merge-rename.sh index 47d4434d64..3f64f62224 100755 --- a/t/t6402-merge-rename.sh +++ b/t/t6402-merge-rename.sh @@ -320,7 +320,12 @@ test_expect_success 'Rename+D/F conflict; renamed file merges but dir in way' ' test_i18ngrep "CONFLICT (modify/delete): dir/file-in-the-way" output && test_i18ngrep "Auto-merging dir" output && - test_i18ngrep "Adding as dir~HEAD instead" output && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test_i18ngrep "moving it to dir~HEAD instead" output + else + test_i18ngrep "Adding as dir~HEAD instead" output + fi && test 3 -eq "$(git ls-files -u | wc -l)" && test 2 -eq "$(git ls-files -u dir/file-in-the-way | wc -l)" && @@ -342,7 +347,12 @@ test_expect_success 'Same as previous, but merged other way' ' ! grep "error: refusing to lose untracked file at" errors && test_i18ngrep "CONFLICT (modify/delete): dir/file-in-the-way" output && test_i18ngrep "Auto-merging dir" output && - test_i18ngrep "Adding as dir~renamed-file-has-no-conflicts instead" output && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test_i18ngrep "moving it to dir~renamed-file-has-no-conflicts instead" output + else + test_i18ngrep "Adding as dir~renamed-file-has-no-conflicts instead" output + fi && test 3 -eq "$(git ls-files -u | wc -l)" && test 2 -eq "$(git ls-files -u dir/file-in-the-way | wc -l)" && diff --git a/t/t6437-submodule-merge.sh b/t/t6437-submodule-merge.sh index 6a1e5f8232..3ead2b726f 100755 --- a/t/t6437-submodule-merge.sh +++ b/t/t6437-submodule-merge.sh @@ -127,7 +127,12 @@ test_expect_success 'merging should conflict for non fast-forward' ' git checkout -b test-nonforward b && (cd sub && git rev-parse sub-d > ../expect) && - test_must_fail git merge c 2> actual && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test_must_fail git merge c >actual + else + test_must_fail git merge c 2> actual + fi && grep $(cat expect) actual > /dev/null && git reset --hard) ' @@ -138,9 +143,21 @@ test_expect_success 'merging should fail for ambiguous common parent' ' (cd sub && git checkout -b ambiguous sub-b && git merge sub-c && - git rev-parse sub-d > ../expect1 && - git rev-parse ambiguous > ../expect2) && - test_must_fail git merge c 2> actual && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + git rev-parse --short sub-d >../expect1 && + git rev-parse --short ambiguous >../expect2 + else + git rev-parse sub-d > ../expect1 && + git rev-parse ambiguous > ../expect2 + fi + ) && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test_must_fail git merge c >actual + else + test_must_fail git merge c 2> actual + fi && grep $(cat expect1) actual > /dev/null && grep $(cat expect2) actual > /dev/null && git reset --hard) diff --git a/t/t7602-merge-octopus-many.sh b/t/t7602-merge-octopus-many.sh index 6abe441ae3..b205b5619e 100755 --- a/t/t7602-merge-octopus-many.sh +++ b/t/t7602-merge-octopus-many.sh @@ -77,6 +77,10 @@ Merge made by the 'recursive' strategy. EOF test_expect_success 'merge reduces irrelevant remote heads' ' + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + sed -i'' s/recursive/ort/ expected + fi && GIT_MERGE_VERBOSITY=0 git merge c4 c5 >actual && test_i18ncmp expected actual ' From patchwork Fri Oct 23 16:01:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 11853817 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0444BC55179 for ; Fri, 23 Oct 2020 16:01:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ABB1022210 for ; Fri, 23 Oct 2020 16:01:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FjZoLSVV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751225AbgJWQBo (ORCPT ); Fri, 23 Oct 2020 12:01:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751220AbgJWQBl (ORCPT ); Fri, 23 Oct 2020 12:01:41 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72086C0613D2 for ; Fri, 23 Oct 2020 09:01:39 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id y12so2481131wrp.6 for ; Fri, 23 Oct 2020 09:01:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=/RJodLrhrZB0Tw1j/DElxsuBn696TMLb/sWHDwufkIU=; b=FjZoLSVVRJHzZx5HQqMPKicdcG/RbUcK4hktgoLzy1arCAE1VvxtKXVbZ7HbsMmQWi xOpX3wzcBHsatQLeAIBIk/aU0nf4s2vZDsq3BgmgvVM3+1k6JvpWHj6h7gW3UfbFS62c aKmiHrgwU6czi1uihUOPezjOROKNfUhGUXrmTeU+6Jp0XuOZGWu6yEt1LcCB/MDpn1SH yqsODMya3J1tA6ABQdgyxXcNoaLRyLp7n8xEho9VGh4v4gIlihZ79R5KWCIAcaxZUNwr tvpX1lSYa+wr1gMWAMytLraXJ/XthgU6Aw4PFcwTvCboUQOg+z/gUgCECQ7VRWtA2J+B DF2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=/RJodLrhrZB0Tw1j/DElxsuBn696TMLb/sWHDwufkIU=; b=L1+p36/2Afruhr2ExylZTVeU/EJMtvQuZTgRiSt9FyCnH42m3s3MBHCbEl7US7b6i6 fxMD3otknuJPqp9Ozcerpwb7d2F3IJ2mnoKchyEiQ17LSC8/YQne60Ikw2T6QP/Q7VnK y08DY6NUBoW7NPw2n5I9A75iWyF1cYIDEYpdAE210RgXDwY9a7lW097ytF0ZNtr4YZmy CptwGHLjuu1cZybNsz2MPA/diypd88eyDfZ3XoiaFb9EOsBnbPSkbkAcpyj8/8YV7f44 Hi/DuXEgmuD/JIdp0JlHux4vvRpQ43nUKppWOQOd0Hrn/IhLlWvhjVJTfe60rSRisUdi cmTw== X-Gm-Message-State: AOAM532Qn7kJ+CL3V0hdRwNEQaFg22LBvSKw518zVXIWKAVjeu/OydkG +dzF119kWyRdMEYAlIi2F0nrEkILTkA= X-Google-Smtp-Source: ABdhPJxPjB08dIRpQnJmdAxPbNk71jyJaOe4wtCnLvqbYSYshs9W9Q9kHm/wKMLUj22cGV5zZ4F21A== X-Received: by 2002:adf:f54c:: with SMTP id j12mr3350995wrp.413.1603468897489; Fri, 23 Oct 2020 09:01:37 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id h128sm4118691wme.38.2020.10.23.09.01.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Oct 2020 09:01:37 -0700 (PDT) Message-Id: <9d46cc1ef3dbc863c48a446f40419470b1bad5a3.1603468885.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 23 Oct 2020 16:01:22 +0000 Subject: [PATCH 7/9] t6423, t6436: note improved ort handling with dirty files Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren The "recursive" backend relies on unpack_trees() to check if unstaged changes would be overwritten by a merge, but unpack_trees() does not understand renames -- and once it returns, it has already written many updates to the working tree and index. As such, "recursive" had to do a special 4-way merge where it would need to also treat the working copy as an extra source of differences that we had to carefully avoid overwriting and resulting in moving files to new locations to avoid conflicts. The "ort" backend, by contrast, does the complete merge inmemory, and only updates the index and working copy as a post-processing step. If there are dirty files in the way, it can simply abort the merge. Update t6423 and t6436 to reflect the better merge abilities and expectations we have for ort, while still leaving the best-case-as-good-as-recursive-can-do expectations there for the recursive backend so we retain its stability until we are ready to deprecate and remove it. Signed-off-by: Elijah Newren --- t/t6423-merge-rename-directories.sh | 266 ++++++++++++++++------------ t/t6436-merge-overwrite.sh | 18 +- 2 files changed, 165 insertions(+), 119 deletions(-) diff --git a/t/t6423-merge-rename-directories.sh b/t/t6423-merge-rename-directories.sh index 7e32626913..32e6925ca4 100755 --- a/t/t6423-merge-rename-directories.sh +++ b/t/t6423-merge-rename-directories.sh @@ -3634,28 +3634,35 @@ test_expect_success '11a: Avoid losing dirty contents with simple rename' ' echo stuff >>z/c && test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err && - test_i18ngrep "Refusing to lose dirty file at z/c" out && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test_path_is_missing .git/MERGE_HEAD && + test_i18ngrep "error: Your local changes to the following files would be overwritten by merge" err + else + test_i18ngrep "Refusing to lose dirty file at z/c" out && - test_seq 1 10 >expected && - echo stuff >>expected && - test_cmp expected z/c && + git ls-files -s >out && + test_line_count = 2 out && + git ls-files -u >out && + test_line_count = 1 out && + git ls-files -o >out && + test_line_count = 3 out && - git ls-files -s >out && - test_line_count = 2 out && - git ls-files -u >out && - test_line_count = 1 out && - git ls-files -o >out && - test_line_count = 4 out && + git rev-parse >actual \ + :0:z/a :2:z/c && + git rev-parse >expect \ + O:z/a B:z/b && + test_cmp expect actual && - git rev-parse >actual \ - :0:z/a :2:z/c && - git rev-parse >expect \ - O:z/a B:z/b && - test_cmp expect actual && + git hash-object z/c~HEAD >actual && + git rev-parse B:z/b >expect && + test_cmp expect actual + fi && + + test_seq 1 10 >expected && + echo stuff >>expected && + test_cmp expected z/c - git hash-object z/c~HEAD >actual && - git rev-parse B:z/b >expect && - test_cmp expect actual ) ' @@ -3706,32 +3713,39 @@ test_expect_success '11b: Avoid losing dirty file involved in directory rename' git checkout A^0 && echo stuff >>z/c && - git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err && - test_i18ngrep "Refusing to lose dirty file at z/c" out && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err && + test_path_is_missing .git/MERGE_HEAD && + test_i18ngrep "error: Your local changes to the following files would be overwritten by merge" err + else + git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err && + test_i18ngrep "Refusing to lose dirty file at z/c" out && - grep -q stuff z/c && - test_seq 1 10 >expected && - echo stuff >>expected && - test_cmp expected z/c && + git ls-files -s >out && + test_line_count = 3 out && + git ls-files -u >out && + test_line_count = 0 out && + git ls-files -m >out && + test_line_count = 0 out && + git ls-files -o >out && + test_line_count = 3 out && - git ls-files -s >out && - test_line_count = 3 out && - git ls-files -u >out && - test_line_count = 0 out && - git ls-files -m >out && - test_line_count = 0 out && - git ls-files -o >out && - test_line_count = 4 out && + git rev-parse >actual \ + :0:x/b :0:y/a :0:y/c && + git rev-parse >expect \ + O:x/b O:z/a B:x/c && + test_cmp expect actual && - git rev-parse >actual \ - :0:x/b :0:y/a :0:y/c && - git rev-parse >expect \ - O:x/b O:z/a B:x/c && - test_cmp expect actual && + git hash-object y/c >actual && + git rev-parse B:x/c >expect && + test_cmp expect actual + fi && - git hash-object y/c >actual && - git rev-parse B:x/c >expect && - test_cmp expect actual + grep -q stuff z/c && + test_seq 1 10 >expected && + echo stuff >>expected && + test_cmp expected z/c ) ' @@ -3783,7 +3797,13 @@ test_expect_success '11c: Avoid losing not-uptodate with rename + D/F conflict' echo stuff >>y/c && test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err && - test_i18ngrep "following files would be overwritten by merge" err && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test_path_is_missing .git/MERGE_HEAD && + test_i18ngrep "error: Your local changes to the following files would be overwritten by merge" err + else + test_i18ngrep "following files would be overwritten by merge" err + fi && grep -q stuff y/c && test_seq 1 10 >expected && @@ -3851,29 +3871,35 @@ test_expect_success '11d: Avoid losing not-uptodate with rename + D/F conflict' echo stuff >>z/c && test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err && - test_i18ngrep "Refusing to lose dirty file at z/c" out && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test_path_is_missing .git/MERGE_HEAD && + test_i18ngrep "error: Your local changes to the following files would be overwritten by merge" err + else + test_i18ngrep "Refusing to lose dirty file at z/c" out && - grep -q stuff z/c && - test_seq 1 10 >expected && - echo stuff >>expected && - test_cmp expected z/c && + git ls-files -s >out && + test_line_count = 4 out && + git ls-files -u >out && + test_line_count = 1 out && + git ls-files -o >out && + test_line_count = 4 out && - git ls-files -s >out && - test_line_count = 4 out && - git ls-files -u >out && - test_line_count = 1 out && - git ls-files -o >out && - test_line_count = 5 out && + git rev-parse >actual \ + :0:x/b :0:y/a :0:y/c/d :3:y/c && + git rev-parse >expect \ + O:x/b O:z/a B:y/c/d B:x/c && + test_cmp expect actual && - git rev-parse >actual \ - :0:x/b :0:y/a :0:y/c/d :3:y/c && - git rev-parse >expect \ - O:x/b O:z/a B:y/c/d B:x/c && - test_cmp expect actual && + git hash-object y/c~HEAD >actual && + git rev-parse B:x/c >expect && + test_cmp expect actual + fi && - git hash-object y/c~HEAD >actual && - git rev-parse B:x/c >expect && - test_cmp expect actual + grep -q stuff z/c && + test_seq 1 10 >expected && + echo stuff >>expected && + test_cmp expected z/c ) ' @@ -3931,37 +3957,43 @@ test_expect_success '11e: Avoid deleting not-uptodate with dir rename/rename(1to echo mods >>y/c && test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err && - test_i18ngrep "CONFLICT (rename/rename)" out && - test_i18ngrep "Refusing to lose dirty file at y/c" out && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test_path_is_missing .git/MERGE_HEAD && + test_i18ngrep "error: Your local changes to the following files would be overwritten by merge" err + else + test_i18ngrep "CONFLICT (rename/rename)" out && + test_i18ngrep "Refusing to lose dirty file at y/c" out && - git ls-files -s >out && - test_line_count = 7 out && - git ls-files -u >out && - test_line_count = 4 out && - git ls-files -o >out && - test_line_count = 3 out && + git ls-files -s >out && + test_line_count = 7 out && + git ls-files -u >out && + test_line_count = 4 out && + git ls-files -o >out && + test_line_count = 3 out && + + git rev-parse >actual \ + :0:y/a :0:y/b :0:x/d :1:x/c :2:w/c :2:y/c :3:y/c && + git rev-parse >expect \ + O:z/a O:z/b O:x/d O:x/c O:x/c A:y/c O:x/c && + test_cmp expect actual && + + # See if y/c~merged has expected contents; requires manually + # doing the expected file merge + git cat-file -p A:y/c >c1 && + git cat-file -p B:z/c >c2 && + >empty && + test_must_fail git merge-file \ + -L "HEAD" \ + -L "" \ + -L "B^0" \ + c1 empty c2 && + test_cmp c1 y/c~merged + fi && echo different >expected && echo mods >>expected && - test_cmp expected y/c && - - git rev-parse >actual \ - :0:y/a :0:y/b :0:x/d :1:x/c :2:w/c :2:y/c :3:y/c && - git rev-parse >expect \ - O:z/a O:z/b O:x/d O:x/c O:x/c A:y/c O:x/c && - test_cmp expect actual && - - # See if y/c~merged has expected contents; requires manually - # doing the expected file merge - git cat-file -p A:y/c >c1 && - git cat-file -p B:z/c >c2 && - >empty && - test_must_fail git merge-file \ - -L "HEAD" \ - -L "" \ - -L "B^0" \ - c1 empty c2 && - test_cmp c1 y/c~merged + test_cmp expected y/c ) ' @@ -4014,38 +4046,44 @@ test_expect_success '11f: Avoid deleting not-uptodate with dir rename/rename(2to echo important >>y/wham && test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err && - test_i18ngrep "CONFLICT (rename/rename)" out && - test_i18ngrep "Refusing to lose dirty file at y/wham" out && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test_path_is_missing .git/MERGE_HEAD && + test_i18ngrep "error: Your local changes to the following files would be overwritten by merge" err + else + test_i18ngrep "CONFLICT (rename/rename)" out && + test_i18ngrep "Refusing to lose dirty file at y/wham" out && - git ls-files -s >out && - test_line_count = 4 out && - git ls-files -u >out && - test_line_count = 2 out && - git ls-files -o >out && - test_line_count = 3 out && + git ls-files -s >out && + test_line_count = 4 out && + git ls-files -u >out && + test_line_count = 2 out && + git ls-files -o >out && + test_line_count = 3 out && - test_seq 1 10 >expected && - echo important >>expected && - test_cmp expected y/wham && + test_must_fail git rev-parse :1:y/wham && - test_must_fail git rev-parse :1:y/wham && + git rev-parse >actual \ + :0:y/a :0:y/b :2:y/wham :3:y/wham && + git rev-parse >expect \ + O:z/a O:z/b O:x/c O:x/d && + test_cmp expect actual && - git rev-parse >actual \ - :0:y/a :0:y/b :2:y/wham :3:y/wham && - git rev-parse >expect \ - O:z/a O:z/b O:x/c O:x/d && - test_cmp expect actual && + # Test that two-way merge in y/wham~merged is as expected + git cat-file -p :2:y/wham >expect && + git cat-file -p :3:y/wham >other && + >empty && + test_must_fail git merge-file \ + -L "HEAD" \ + -L "" \ + -L "B^0" \ + expect empty other && + test_cmp expect y/wham~merged + fi && - # Test that the two-way merge in y/wham~merged is as expected - git cat-file -p :2:y/wham >expect && - git cat-file -p :3:y/wham >other && - >empty && - test_must_fail git merge-file \ - -L "HEAD" \ - -L "" \ - -L "B^0" \ - expect empty other && - test_cmp expect y/wham~merged + test_seq 1 10 >expected && + echo important >>expected && + test_cmp expected y/wham ) ' diff --git a/t/t6436-merge-overwrite.sh b/t/t6436-merge-overwrite.sh index dd8ab7ede1..dd9376842f 100755 --- a/t/t6436-merge-overwrite.sh +++ b/t/t6436-merge-overwrite.sh @@ -97,11 +97,19 @@ test_expect_success 'will not overwrite unstaged changes in renamed file' ' git mv c1.c other.c && git commit -m rename && cp important other.c && - test_must_fail git merge c1a >out && - test_i18ngrep "Refusing to lose dirty file at other.c" out && - test_path_is_file other.c~HEAD && - test $(git hash-object other.c~HEAD) = $(git rev-parse c1a:c1.c) && - test_cmp important other.c + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test_must_fail git merge c1a >out 2>err && + test_i18ngrep "would be overwritten by merge" err && + test_cmp important other.c && + test_path_is_missing .git/MERGE_HEAD + else + test_must_fail git merge c1a >out && + test_i18ngrep "Refusing to lose dirty file at other.c" out && + test_path_is_file other.c~HEAD && + test $(git hash-object other.c~HEAD) = $(git rev-parse c1a:c1.c) && + test_cmp important other.c + fi ' test_expect_success 'will not overwrite untracked subtree' ' From patchwork Fri Oct 23 16:01:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 11853813 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECBC7C5517A for ; Fri, 23 Oct 2020 16:01:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 91ADC21D47 for ; Fri, 23 Oct 2020 16:01:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hfKGZ5r4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751227AbgJWQBo (ORCPT ); Fri, 23 Oct 2020 12:01:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751224AbgJWQBl (ORCPT ); Fri, 23 Oct 2020 12:01:41 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBFECC0613D4 for ; Fri, 23 Oct 2020 09:01:39 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id g12so2473900wrp.10 for ; Fri, 23 Oct 2020 09:01:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=6GQbWuh37mT7te6bMTumGT3vAbVRprkgFjHvwvPU8nI=; b=hfKGZ5r44hXL2EhFuSjlJ6gfi+gm7Dpag1Je9muAhHRexivs40Z2OHwx+6qg1FRyFb 1xlfTL9TIqhDD4Tz9y5yRRviHZlyRpJMlFKe/+pDAS/ZboDpwDObVGALB5VI7/tRvsZ+ NGo0a7VYM6x0XD5oq6geJ3GCLvId+7XkfcX1SyUYf5xldHAd6kD2/X2oIangizv2YCTb XCJu6OpslT0rtA68Xe1DytWYR451SZuRi4Nb/xCwYOKUIQhss9oUnRCtQMiSvZbSuXQf wUDMusyoCwTkm8pmllWFuzWe9sxARhuGZccLbxAsDITIX2vZHx3eO5qKGl0d1BeHOt5X DcFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=6GQbWuh37mT7te6bMTumGT3vAbVRprkgFjHvwvPU8nI=; b=CmFlLVg6vKuhBjWpVJbrDZxN8v0WHDe9IC2j+utBZGV6Ods0lZvNMnRdzV1YO0WS5r w+UgWB2K4l4PNzmSa5InYrmRe60z5UgthRs70OykbZl+tnVJtYXnIcLuQ43U8aTa+bCp GI1Q1UFTh8ZAYvq+b1qPr4+PYCp92Un9kBDJv8yWZ1DKG5NjY3MbASufMX4mn8nqbCMw XE/6k9Pc8PkX0rAIDzI3ouZeA8MGL5qrr0on+/xBTlN8mfbqz5f9Td61juIB+F6oxCLP BCtZdxmL1EWNCBVmgdvWRKzAuryiJmE3/jVINmR0u9uQjStaHSMD9Sbosz6ye2v1WeXC biuQ== X-Gm-Message-State: AOAM532zeWkIeJXQlaZtsMZDtb3aT95CScUtJordjtRM6Jsi8w61uQ9R Ebj/61unbJwbt6uInQPg6J8llR0fIwo= X-Google-Smtp-Source: ABdhPJxj1FiVz2jV0ZPtycYIl+BiAPemPTjNSxrUn9xKIMpf5JYw+wPfVAQO2Vs9bk/nAUpKnH7h7w== X-Received: by 2002:a5d:63cb:: with SMTP id c11mr3160538wrw.243.1603468898314; Fri, 23 Oct 2020 09:01:38 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id i10sm4687140wrq.27.2020.10.23.09.01.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Oct 2020 09:01:37 -0700 (PDT) Message-Id: <436577106e6ad079ece200fc318acab9262f6ce7.1603468885.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 23 Oct 2020 16:01:23 +0000 Subject: [PATCH 8/9] t6423: note improved ort handling with untracked files Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Similar to the previous commit, since the "recursive" backend relies on unpack_trees() to check if unstaged or untracked files would be overwritten by a merge, and unpack_trees() does not understand renames -- it has false positives and false negatives. Once it has run, since it updates as it goes, merge-recursive then has to handle completing the merge as best it can despite extra changes in the working copy. However, this is not just an issue for dirty files, but also for untracked files because directory renames can cause file contents to need to be written to a location that was not tracked on either side of history. Since the "ort" backend does the complete merge inmemory, and only updates the index and working copy as a post-processing step, if there are untracked files in the way it can simply abort the merge much like checkout does. Update t6423 to reflect the better merge abilities and expectations for ort, while still leaving the best-case-as-good-as-recursive-can-do expectations there for the recursive backend so we retain its stability until we are ready to deprecate and remove it. Signed-off-by: Elijah Newren --- t/t6423-merge-rename-directories.sh | 195 ++++++++++++++++++---------- 1 file changed, 124 insertions(+), 71 deletions(-) diff --git a/t/t6423-merge-rename-directories.sh b/t/t6423-merge-rename-directories.sh index 32e6925ca4..db694a6316 100755 --- a/t/t6423-merge-rename-directories.sh +++ b/t/t6423-merge-rename-directories.sh @@ -3214,6 +3214,7 @@ test_expect_success '10a: Overwrite untracked with normal rename/delete' ' echo important >z/d && test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err && + test_path_is_missing .git/MERGE_HEAD && test_i18ngrep "The following untracked working tree files would be overwritten by merge" err && git ls-files -s >out && @@ -3283,21 +3284,34 @@ test_expect_success '10b: Overwrite untracked with dir rename + delete' ' echo contents >y/e && test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err && - test_i18ngrep "CONFLICT (rename/delete).*Version B\^0 of y/d left in tree at y/d~B\^0" out && - test_i18ngrep "Error: Refusing to lose untracked file at y/e; writing to y/e~B\^0 instead" out && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test_path_is_missing .git/MERGE_HEAD && + test_i18ngrep "error: The following untracked working tree files would be overwritten by merge" err && - git ls-files -s >out && - test_line_count = 3 out && - git ls-files -u >out && - test_line_count = 2 out && - git ls-files -o >out && - test_line_count = 5 out && + git ls-files -s >out && + test_line_count = 1 out && + git ls-files -u >out && + test_line_count = 0 out && + git ls-files -o >out && + test_line_count = 5 out + else + test_i18ngrep "CONFLICT (rename/delete).*Version B\^0 of y/d left in tree at y/d~B\^0" out && + test_i18ngrep "Error: Refusing to lose untracked file at y/e; writing to y/e~B\^0 instead" out && - git rev-parse >actual \ - :0:y/b :3:y/d :3:y/e && - git rev-parse >expect \ - O:z/b O:z/c B:z/e && - test_cmp expect actual && + git ls-files -s >out && + test_line_count = 3 out && + git ls-files -u >out && + test_line_count = 2 out && + git ls-files -o >out && + test_line_count = 5 out && + + git rev-parse >actual \ + :0:y/b :3:y/d :3:y/e && + git rev-parse >expect \ + O:z/b O:z/c B:z/e && + test_cmp expect actual + fi && echo very >expect && test_cmp expect y/c && @@ -3360,25 +3374,38 @@ test_expect_success '10c1: Overwrite untracked with dir rename/rename(1to2)' ' echo important >y/c && test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err && - test_i18ngrep "CONFLICT (rename/rename)" out && - test_i18ngrep "Refusing to lose untracked file at y/c; adding as y/c~B\^0 instead" out && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test_path_is_missing .git/MERGE_HEAD && + test_i18ngrep "error: The following untracked working tree files would be overwritten by merge" err && - git ls-files -s >out && - test_line_count = 6 out && - git ls-files -u >out && - test_line_count = 3 out && - git ls-files -o >out && - test_line_count = 3 out && + git ls-files -s >out && + test_line_count = 4 out && + git ls-files -u >out && + test_line_count = 0 out && + git ls-files -o >out && + test_line_count = 3 out + else + test_i18ngrep "CONFLICT (rename/rename)" out && + test_i18ngrep "Refusing to lose untracked file at y/c; adding as y/c~B\^0 instead" out && - git rev-parse >actual \ - :0:y/a :0:y/b :0:x/d :1:x/c :2:w/c :3:y/c && - git rev-parse >expect \ - O:z/a O:z/b O:x/d O:x/c O:x/c O:x/c && - test_cmp expect actual && + git ls-files -s >out && + test_line_count = 6 out && + git ls-files -u >out && + test_line_count = 3 out && + git ls-files -o >out && + test_line_count = 3 out && - git hash-object y/c~B^0 >actual && - git rev-parse O:x/c >expect && - test_cmp expect actual && + git rev-parse >actual \ + :0:y/a :0:y/b :0:x/d :1:x/c :2:w/c :3:y/c && + git rev-parse >expect \ + O:z/a O:z/b O:x/d O:x/c O:x/c O:x/c && + test_cmp expect actual && + + git hash-object y/c~B^0 >actual && + git rev-parse O:x/c >expect && + test_cmp expect actual + fi && echo important >expect && test_cmp expect y/c @@ -3398,25 +3425,38 @@ test_expect_success '10c2: Overwrite untracked with dir rename/rename(1to2), oth echo important >y/c && test_must_fail git -c merge.directoryRenames=true merge -s recursive A^0 >out 2>err && - test_i18ngrep "CONFLICT (rename/rename)" out && - test_i18ngrep "Refusing to lose untracked file at y/c; adding as y/c~HEAD instead" out && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test_path_is_missing .git/MERGE_HEAD && + test_i18ngrep "error: The following untracked working tree files would be overwritten by merge" err && - git ls-files -s >out && - test_line_count = 6 out && - git ls-files -u >out && - test_line_count = 3 out && - git ls-files -o >out && - test_line_count = 3 out && + git ls-files -s >out && + test_line_count = 4 out && + git ls-files -u >out && + test_line_count = 0 out && + git ls-files -o >out && + test_line_count = 3 out + else + test_i18ngrep "CONFLICT (rename/rename)" out && + test_i18ngrep "Refusing to lose untracked file at y/c; adding as y/c~HEAD instead" out && - git rev-parse >actual \ - :0:y/a :0:y/b :0:x/d :1:x/c :3:w/c :2:y/c && - git rev-parse >expect \ - O:z/a O:z/b O:x/d O:x/c O:x/c O:x/c && - test_cmp expect actual && + git ls-files -s >out && + test_line_count = 6 out && + git ls-files -u >out && + test_line_count = 3 out && + git ls-files -o >out && + test_line_count = 3 out && - git hash-object y/c~HEAD >actual && - git rev-parse O:x/c >expect && - test_cmp expect actual && + git rev-parse >actual \ + :0:y/a :0:y/b :0:x/d :1:x/c :3:w/c :2:y/c && + git rev-parse >expect \ + O:z/a O:z/b O:x/d O:x/c O:x/c O:x/c && + test_cmp expect actual && + + git hash-object y/c~HEAD >actual && + git rev-parse O:x/c >expect && + test_cmp expect actual + fi && echo important >expect && test_cmp expect y/c @@ -3474,37 +3514,50 @@ test_expect_success '10d: Delete untracked with dir rename/rename(2to1)' ' echo important >y/wham && test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err && - test_i18ngrep "CONFLICT (rename/rename)" out && - test_i18ngrep "Refusing to lose untracked file at y/wham" out && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test_path_is_missing .git/MERGE_HEAD && + test_i18ngrep "error: The following untracked working tree files would be overwritten by merge" err && - git ls-files -s >out && - test_line_count = 6 out && - git ls-files -u >out && - test_line_count = 2 out && - git ls-files -o >out && - test_line_count = 3 out && + git ls-files -s >out && + test_line_count = 6 out && + git ls-files -u >out && + test_line_count = 0 out && + git ls-files -o >out && + test_line_count = 3 out + else + test_i18ngrep "CONFLICT (rename/rename)" out && + test_i18ngrep "Refusing to lose untracked file at y/wham" out && - git rev-parse >actual \ - :0:y/a :0:y/b :0:y/d :0:y/e :2:y/wham :3:y/wham && - git rev-parse >expect \ - O:z/a O:z/b O:x/d O:x/e O:z/c O:x/f && - test_cmp expect actual && + git ls-files -s >out && + test_line_count = 6 out && + git ls-files -u >out && + test_line_count = 2 out && + git ls-files -o >out && + test_line_count = 3 out && + + git rev-parse >actual \ + :0:y/a :0:y/b :0:y/d :0:y/e :2:y/wham :3:y/wham && + git rev-parse >expect \ + O:z/a O:z/b O:x/d O:x/e O:z/c O:x/f && + test_cmp expect actual && - test_must_fail git rev-parse :1:y/wham && + test_must_fail git rev-parse :1:y/wham && - echo important >expect && - test_cmp expect y/wham && + # Test that two-way merge in y/wham~merged is as expected + git cat-file -p :2:y/wham >expect && + git cat-file -p :3:y/wham >other && + >empty && + test_must_fail git merge-file \ + -L "HEAD" \ + -L "" \ + -L "B^0" \ + expect empty other && + test_cmp expect y/wham~merged + fi && - # Test that the two-way merge in y/wham~merged is as expected - git cat-file -p :2:y/wham >expect && - git cat-file -p :3:y/wham >other && - >empty && - test_must_fail git merge-file \ - -L "HEAD" \ - -L "" \ - -L "B^0" \ - expect empty other && - test_cmp expect y/wham~merged + echo important >expect && + test_cmp expect y/wham ) ' From patchwork Fri Oct 23 16:01:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 11853807 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C14A2C388F9 for ; Fri, 23 Oct 2020 16:01:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 65F6A21D47 for ; Fri, 23 Oct 2020 16:01:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WqRRvnYn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751223AbgJWQBl (ORCPT ); Fri, 23 Oct 2020 12:01:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S460371AbgJWQBk (ORCPT ); Fri, 23 Oct 2020 12:01:40 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 979D1C0613CE for ; Fri, 23 Oct 2020 09:01:40 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id w23so973780wmi.4 for ; Fri, 23 Oct 2020 09:01:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=3IuLa9F3kKubcVyPwscUTm7O5LitS+oeoDzry0DsLaw=; b=WqRRvnYnYD4iHu9INrPWEKKDAtE6EvKNRjJK77lNCTHi3OmbBTQNbym/dz5pTbw236 XPDpc8lG0Rd+nW5Y9tlp+C+BE9gg8W6x2ILj69Mda/zRSiv7LED1j0iNDVDzCkiXhFXS fdFUacEK6LlgYJYbVVwDA8Kr/+os/vl6nnlaSscq9hru6xngFKijIx0JWBh6g8xIwJbC UmFiCzOSvkxFxcxv1CjCvPbNFQdSqUmLYIMytfSjDR5I7IaKN8QZEcPLV9MWN/lAob4j MPSPg6z/PMMEWW6uz/UuWBW7Lyp+PzYPhHnjHzZW7cNrkQfFo+5hfSRRYTitK55kYF6+ Vz3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=3IuLa9F3kKubcVyPwscUTm7O5LitS+oeoDzry0DsLaw=; b=Y/1mAF8ZhOurDU2+SzuU2sgDaqQGRELglp9aToxc4EjT5OFx/65UgFIPLjc01t2kc3 66VDM+vcbrsxlO1+1a1KtPVrJb4hcF62m5IFEPhuM0dudYm3wFfrWGNzsMmKZUrXu2Oo bDxXbA1NrsvYq77BYH9u1aWFm9KzxN+9fYYkcJviIy1yv2/E6tR8GLolf2qOGMzyQGUO mOW16PalhpI98SPy7JHj5qOW/lQ7qAGQB8dGzGwrZ+QXl61Fl16HxKzMqDvc98dSugS3 7NlUCLb2sQgGl5jk5BHPRLelANaeNUXXh/Xs/mDa2ZtjxfZTnTzoO0MGdQ08LhM6PUQ/ XUxA== X-Gm-Message-State: AOAM532dTxHdMWxwuKFBByJL91wA2Og8Os7X2gLBZQtMjn7mfFsrOXTw 7yt6o5N+XvnAVDFEmp0rvQL1tjfPP5M= X-Google-Smtp-Source: ABdhPJwa8b/NJSoMa3oOzwPaS6+LhIHDGLYAWEZcLTEryJhSolooJrn5/x3h3DxL7/4LS2EdRZLshA== X-Received: by 2002:a1c:5f84:: with SMTP id t126mr2987171wmb.89.1603468899179; Fri, 23 Oct 2020 09:01:39 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id i33sm4209815wri.79.2020.10.23.09.01.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Oct 2020 09:01:38 -0700 (PDT) Message-Id: <2659d1cb987735ec123ca7a82ed7e058e4d6bef0.1603468885.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 23 Oct 2020 16:01:24 +0000 Subject: [PATCH 9/9] t6423: add more details about direct resolution of directories Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Signed-off-by: Elijah Newren --- t/t6423-merge-rename-directories.sh | 37 ++++++++++++++++------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/t/t6423-merge-rename-directories.sh b/t/t6423-merge-rename-directories.sh index db694a6316..9e51320ee0 100755 --- a/t/t6423-merge-rename-directories.sh +++ b/t/t6423-merge-rename-directories.sh @@ -4725,20 +4725,22 @@ test_expect_success '12e: Rename/merge subdir into the root, variant 2' ' # folder/subdir/newsubdir/e_Merge2 # folder/subdir/tweaked/{h,Makefile_SUB_Merge1,newfile.py} # folder/unchanged/ -# -# Notes: This testcase happens to exercise lots of the -# optimization-specific codepaths in merge-ort, and also -# demonstrated a failing of the directory rename detection algorithm -# in merge-recursive; newfile.c should not get pushed into -# folder/subdir/newsubdir/, yet merge-recursive put it there because -# the rename of dir/subdir/{a,b,c,d} -> folder/subdir/{a,b,c,d} -# looks like -# dir/ -> folder/, -# whereas the rename of dir/subdir/e -> folder/subdir/newsubdir/e -# looks like -# dir/subdir/ -> folder/subdir/newsubdir/ -# and if we note that newfile.c is found in dir/subdir/, we might -# overlook the dir/ -> folder/ rule that has more weight. +# Things being checked here: +# 1. dir/subdir/newfile.c does not get pushed into folder/subdir/newsubdir/. +# dir/subdir/{a,b,c,d} -> folder/subdir/{a,b,c,d} looks like +# dir/ -> folder/, +# whereas dir/subdir/e -> folder/subdir/newsubdir/e looks like +# dir/subdir/ -> folder/subdir/newsubdir/ +# and if we note that newfile.c is found in dir/subdir/, we might overlook +# the dir/ -> folder/ rule that has more weight. Older git versions did +# this. +# 2. The code to do trivial directory resolves. Note that +# dir/subdir/unchanged/ is unchanged and can be deleted, and files in the +# new folder/subdir/unchanged/ are not needed as a target to any renames. +# Thus, in the second collect_merge_info_callback() we can just resolve +# these two directories trivially without recursing.) +# 3. Exercising the codepaths for caching renames and deletes from one cherry +# pick and re-applying them in the subsequent one. test_setup_12f () { test_create_repo 12f && @@ -4803,7 +4805,7 @@ test_expect_merge_algorithm failure success '12f: Trivial directory resolve, cac git checkout A^0 && git branch Bmod B && - git -c merge.directoryRenames=true rebase A Bmod && + GIT_TRACE2_PERF="$(pwd)/trace.output" git -c merge.directoryRenames=true rebase A Bmod && echo Checking the pick of B1... && @@ -4884,7 +4886,10 @@ test_expect_merge_algorithm failure success '12f: Trivial directory resolve, cac test_seq 2 12 >e_Merge2 && git hash-object e_Merge2 >expect && git rev-parse Bmod:folder/subdir/newsubdir/e >actual && - test_cmp expect actual + test_cmp expect actual && + + grep region_enter.*collect_merge_info trace.output >collect && + test_line_count = 4 collect ) '