From patchwork Wed Jun 9 19:28:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12311123 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 113D0C48BCF for ; Wed, 9 Jun 2021 19:28:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EC3E9613FE for ; Wed, 9 Jun 2021 19:28:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229715AbhFITaw (ORCPT ); Wed, 9 Jun 2021 15:30:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229472AbhFITav (ORCPT ); Wed, 9 Jun 2021 15:30:51 -0400 Received: from mail-ot1-x333.google.com (mail-ot1-x333.google.com [IPv6:2607:f8b0:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7761C061574 for ; Wed, 9 Jun 2021 12:28:56 -0700 (PDT) Received: by mail-ot1-x333.google.com with SMTP id 102-20020a9d0eef0000b02903fccc5b733fso2043223otj.4 for ; Wed, 09 Jun 2021 12:28:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WRSjgvAnvinC9jsqMJ0bgTAJIM41vhXijompJfNqYpw=; b=SX0urmlnb+75B21kH5AhRb3etrvXUq6ghw8cozjAMODIZ4E9cQnuWBJrbI0HvmcdG/ HFCP2idQ2FW2RspMZcb/+MR8KdrnTTv68B+yqSxpGXaqzqozd6TIe5XKu2nBH3B82euM kcc+5sBaDUkboJlIbC/6M4fTrPjYiwexcFsuBeI+4pis5XkTNhGP5MloJoKZVeLRdEBU NIwDPJjojJb/mi6eIP6+i7O0wwJpNBy9eYoRmohpN3iZUe6AxXLCaoKYvXX4djj7lu4G 33XDZeFL/IDd9nbljiuSX4monLJgsOqNkjeHDGzDPMDT2/7G2x8plpG1EXnJXjhRzEOt vPRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WRSjgvAnvinC9jsqMJ0bgTAJIM41vhXijompJfNqYpw=; b=qYD2Jq8so4gIN2n25fLybAzYI3Lex1aYn6AwSsO+a2py8zthkPV7OHlIqpIeErZn/d DtiPurCRuSymfOMDNyYjWMjyhQgGNh01MoZSPFyTVMokjm/qMJV9+KVx9pJ1yb+cdOIw gFM89wlVnocimT0QJLUBOuo5Q/BcwJBjJVeAVZRlT7fyZBbHWhrCK5IKzMar8mEIEzdx S3gLgQntONB887FDZGDD1zw+I/3gKAjYh+cYZ/0BqzIrtl3fMc18gIumXZwtQOgVdHD2 3VqcalaFp751dHsL1HH4zw1nlBKPdTpJK24tcxr/uI8Lh+jaV8O/LVqKvH1/428ecSB6 9pZA== X-Gm-Message-State: AOAM530I4tIOeLQLTEtRn7VxTceHdDK4Y88pHymQM3FEcPTZjUB/ECvV XstofIYVh7qHv9v8nt92R9pGvwS1sapPSw== X-Google-Smtp-Source: ABdhPJw/VtB+8gHZSgDiUpOBoMsglROHd7MkAuHQ1LW6PsmfYoH5AnkJgWasqWCZnWEDNqJQYovweA== X-Received: by 2002:a9d:7012:: with SMTP id k18mr815471otj.179.1623266935985; Wed, 09 Jun 2021 12:28:55 -0700 (PDT) Received: from localhost (fixed-187-188-155-231.totalplay.net. [187.188.155.231]) by smtp.gmail.com with ESMTPSA id t39sm125728ooi.42.2021.06.09.12.28.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 12:28:55 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: David Aguilar , Junio C Hamano , Sergey Organov , Bagas Sanjaya , Elijah Newren , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFy?= =?utf-8?b?bWFzb24=?= , Denton Liu , Felipe Contreras Subject: [PATCH 1/7] test: add merge style config test Date: Wed, 9 Jun 2021 14:28:36 -0500 Message-Id: <20210609192842.696646-2-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0.2.g41be0a4e50 In-Reply-To: <20210609192842.696646-1-felipe.contreras@gmail.com> References: <20210609192842.696646-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We want to test different combinations of merge.conflictstyle, and a new file is the best place to do that. Signed-off-by: Felipe Contreras --- t/t6440-config-conflict-markers.sh | 44 ++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 t/t6440-config-conflict-markers.sh diff --git a/t/t6440-config-conflict-markers.sh b/t/t6440-config-conflict-markers.sh new file mode 100755 index 0000000000..6952552c58 --- /dev/null +++ b/t/t6440-config-conflict-markers.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +test_description='merge style conflict markers configurations' + +. ./test-lib.sh + +fill () { + for i + do + echo "$i" + done +} + +test_expect_success 'merge' ' + test_create_repo merge && + ( + cd merge && + + fill 1 2 3 >content && + git add content && + git commit -m base && + + git checkout -b r && + echo six >>content && + git commit -a -m right && + + git checkout master && + echo 7 >>content && + git commit -a -m left && + + test_must_fail git merge r && + ! grep -E "\|+" content && + + git reset --hard && + test_must_fail git -c merge.conflictstyle=diff3 merge r && + grep -E "\|+" content && + + git reset --hard && + test_must_fail git -c merge.conflictstyle=merge merge r && + ! grep -E "\|+" content + ) +' + +test_done From patchwork Wed Jun 9 19:28:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12311135 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 9DDD2C48BCF for ; Wed, 9 Jun 2021 19:30:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 84F16613FE for ; Wed, 9 Jun 2021 19:30:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229722AbhFITcG (ORCPT ); Wed, 9 Jun 2021 15:32:06 -0400 Received: from mail-ot1-f54.google.com ([209.85.210.54]:34606 "EHLO mail-ot1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbhFITcG (ORCPT ); Wed, 9 Jun 2021 15:32:06 -0400 Received: by mail-ot1-f54.google.com with SMTP id v27-20020a056830091bb02903cd67d40070so21991374ott.1 for ; Wed, 09 Jun 2021 12:29:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GwRxTEzKTIJp89t5MCIr50HGWeRAVJBsKG4euMVU1+U=; b=Pu2XJEK0SS4PMX0FXvsT+rd6aBgTG28P7FM7WfWS/OzYPOkQ+ZQFU3qlUFalltTNTz 1o5mW0NcSxpD627MSTgZJ1H8OQW7O+qzLWil7+z3Th5shJV1Kd+7sxQP60nrEBkHpVio wiVAgw1hLxn4RA5haxCi1eyb2PGtYzQKRuLvQkph3I4MjEjFVSq7Mee++4FJcuPlQX9G +9m7asqskGugTO2+V1PbFyFkmLlQEumWtAx7mHFicFd6JJdwWU6jJZypBSBP+B5o8rjp y9q3mFveeeDr8QEPjBrp1ytFHbERg0PdKQVo4Mm0yaCl02Vb2g/cAScU8ZmzPq6IjNSH L3OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GwRxTEzKTIJp89t5MCIr50HGWeRAVJBsKG4euMVU1+U=; b=MpLM1RnWfihIJTAxoEu9JXSdzhXdAcb3uk6l2FV9V/kpaWjS4pTuG2rnUAhSua9XAl l7TZumK1ZvCu/2o7HzDAa+NyFs6aYgn2U5ql8mW2WlmNiwkGWR+Ne3KGFHxShvRaJHqk IZWWw+fZUbwR+e9MwvWJ6Pbvi5rDJ6zMUzs1DGDI9Yngx1Mp7nMN3ANXBWvbxQzpBAWW nFgcr/fMhriKazNHsENe2dKq2vjFTvS2HhmyNJsJ11b5I04RuxywPUYq4pTtYrg7qikX +b/IRTdAAlxl+YC7VLeLWD94l7vUyD1X1AJXkUGN3HgcGgpykZJ2NuW1GCE19V4c9/nl P0bw== X-Gm-Message-State: AOAM533H7C0ENj2h0GpEx2orrnBplyN9hP/PRqUI9hZwcfKylKca9fNm oyn64S2H3oGqiKkRCoWmOVy/VihK4l+V7Q== X-Google-Smtp-Source: ABdhPJyVRNyYXMMUo4i/zAJAo7zP7vXLcH/I6oSvrR9gbZrn5vFxqr1MK81Lz2UfN6eFqyApbGzTpQ== X-Received: by 2002:a05:6830:90f:: with SMTP id v15mr854076ott.332.1623266937528; Wed, 09 Jun 2021 12:28:57 -0700 (PDT) Received: from localhost (fixed-187-188-155-231.totalplay.net. [187.188.155.231]) by smtp.gmail.com with ESMTPSA id c11sm127435oot.25.2021.06.09.12.28.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 12:28:57 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: David Aguilar , Junio C Hamano , Sergey Organov , Bagas Sanjaya , Elijah Newren , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFy?= =?utf-8?b?bWFzb24=?= , Denton Liu , Felipe Contreras Subject: [PATCH 2/7] merge-tree: fix merge.conflictstyle handling Date: Wed, 9 Jun 2021 14:28:37 -0500 Message-Id: <20210609192842.696646-3-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0.2.g41be0a4e50 In-Reply-To: <20210609192842.696646-1-felipe.contreras@gmail.com> References: <20210609192842.696646-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Currently it's completely ignored. Signed-off-by: Felipe Contreras --- builtin/merge-tree.c | 4 ++++ t/t6440-config-conflict-markers.sh | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c index de8520778d..7d677bd75c 100644 --- a/builtin/merge-tree.c +++ b/builtin/merge-tree.c @@ -7,6 +7,8 @@ #include "blob.h" #include "exec-cmd.h" #include "merge-blobs.h" +#include "config.h" +#include "xdiff-interface.h" static const char merge_tree_usage[] = "git merge-tree "; @@ -378,6 +380,8 @@ int cmd_merge_tree(int argc, const char **argv, const char *prefix) if (argc != 4) usage(merge_tree_usage); + git_config(git_xmerge_config, NULL); + buf1 = get_tree_descriptor(r, t+0, argv[1]); buf2 = get_tree_descriptor(r, t+1, argv[2]); buf3 = get_tree_descriptor(r, t+2, argv[3]); diff --git a/t/t6440-config-conflict-markers.sh b/t/t6440-config-conflict-markers.sh index 6952552c58..978f4e3e70 100755 --- a/t/t6440-config-conflict-markers.sh +++ b/t/t6440-config-conflict-markers.sh @@ -41,4 +41,25 @@ test_expect_success 'merge' ' ) ' +test_expect_success 'merge-tree' ' + test_create_repo merge-tree && + ( + cd merge-tree && + + test_commit initial initial-file initial && + test_commit r content r && + git reset --hard initial && + test_commit l content l && + + git merge-tree initial r l >actual && + ! grep -E "\|+" actual && + + git -c merge.conflictstyle=diff3 merge-tree initial r l >actual && + grep -E "\|+" actual && + + git -c merge.conflictstyle=merge merge-tree initial r l >actual && + ! grep -E "\|+" actual + ) +' + test_done From patchwork Wed Jun 9 19:28:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12311125 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 A9836C48BCF for ; Wed, 9 Jun 2021 19:29:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 901A3613FE for ; Wed, 9 Jun 2021 19:29:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229757AbhFITa4 (ORCPT ); Wed, 9 Jun 2021 15:30:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229788AbhFITaz (ORCPT ); Wed, 9 Jun 2021 15:30:55 -0400 Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EBD5C061574 for ; Wed, 9 Jun 2021 12:29:00 -0700 (PDT) Received: by mail-ot1-x32f.google.com with SMTP id 66-20020a9d02c80000b02903615edf7c1aso25021227otl.13 for ; Wed, 09 Jun 2021 12:29:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RHUHK/+rUCSTcHlOqlRpTvL/q7u/Iltm42HOujgH5Jw=; b=DZimDWBqhmXk/jdUbvC861qHsWNrHE1O0aPVzjReUr/btysP23FuojE7JtGiLUnPCx vax3iA5GAxA8bxRsSi6oIqj+wO7jZ1ldhwo2Ks4NxEzacnfP3Cs7UYxFHDhAmgY0s66H AtdNXcM6p1c37LcCbYggMnOiHe8zZG69THFZf8bE5kC8J4dLpGqfx1yxWHhoAMzwys2E tDoPKO0vc79CrNNycguFX6v4FOG0U3avGZihgqo9967u3diG9IiHHzZQR82hLEBR6owf 0FahExYVkn6LlYfxpqbbWFtZzBFPloEKDz7wc7NE310Y/c0QXvkbZWdy9VdyjBjnykDQ DrEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RHUHK/+rUCSTcHlOqlRpTvL/q7u/Iltm42HOujgH5Jw=; b=mNQ2BEvvGGQxb9RTyInTstJP0NlqZlLi6qaiFT7ZdZFJePn5hnCsu+ibYSjo8HTxPu 7QDCkLtOnMEiZEPED5nbUnqFgzGtUlTXZAFvGFZni0O/LzK3yb1lMvw+L14pIIctHUkG LOdgvzW8PTpyR/Fvr1dLhS//X+0iQa47CT0jLF9TWs1mesdgSUefWpVnjkM598nNcoyP yVj/yBL3CbYtiCi1E1yJY3fXpS3Nr6ALPNxDjouIiqWBWhfso0hEiVETbYzRGDEk4rld LuhV2cBn/waTQc+jNbM5e19nZf5/QqmEwsJVu2P54qT4Gzzp4l6ssMRnATkMLhFo3D9r rlTg== X-Gm-Message-State: AOAM532M8yvAvMjDP0bsDcbD1WA8Gy76R+zE4iEnYa/DIaNzavCX47de NbQmgza5ipveGydPDKaeyqrkcxTJJczHuA== X-Google-Smtp-Source: ABdhPJy1Fy7QEbQTVRrVgP37BXdKRBOOS8oz8mZHsJvOZ0pvoRE5GrUwkCj0WBYUoXKCFPWpZRMozg== X-Received: by 2002:a9d:4d8d:: with SMTP id u13mr786142otk.367.1623266939269; Wed, 09 Jun 2021 12:28:59 -0700 (PDT) Received: from localhost (fixed-187-188-155-231.totalplay.net. [187.188.155.231]) by smtp.gmail.com with ESMTPSA id h8sm137385oie.41.2021.06.09.12.28.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 12:28:58 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: David Aguilar , Junio C Hamano , Sergey Organov , Bagas Sanjaya , Elijah Newren , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFy?= =?utf-8?b?bWFzb24=?= , Denton Liu , Felipe Contreras Subject: [PATCH 3/7] notes: fix merge.conflictstyle handling Date: Wed, 9 Jun 2021 14:28:38 -0500 Message-Id: <20210609192842.696646-4-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0.2.g41be0a4e50 In-Reply-To: <20210609192842.696646-1-felipe.contreras@gmail.com> References: <20210609192842.696646-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Currently it's completely ignored. Signed-off-by: Felipe Contreras --- builtin/notes.c | 3 ++- t/t6440-config-conflict-markers.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/builtin/notes.c b/builtin/notes.c index 74bba39ca8..a333cc68ec 100644 --- a/builtin/notes.c +++ b/builtin/notes.c @@ -23,6 +23,7 @@ #include "notes-merge.h" #include "notes-utils.h" #include "worktree.h" +#include "xdiff-interface.h" static const char * const git_notes_usage[] = { N_("git notes [--ref ] [list []]"), @@ -1000,7 +1001,7 @@ int cmd_notes(int argc, const char **argv, const char *prefix) OPT_END() }; - git_config(git_default_config, NULL); + git_config(git_xmerge_config, NULL); argc = parse_options(argc, argv, prefix, options, git_notes_usage, PARSE_OPT_STOP_AT_NON_OPTION); diff --git a/t/t6440-config-conflict-markers.sh b/t/t6440-config-conflict-markers.sh index 978f4e3e70..44f79ac91b 100755 --- a/t/t6440-config-conflict-markers.sh +++ b/t/t6440-config-conflict-markers.sh @@ -62,4 +62,31 @@ test_expect_success 'merge-tree' ' ) ' +test_expect_success 'notes' ' + test_create_repo notes && + ( + test_commit initial && + + git -c core.notesRef=refs/notes/b notes add -m b initial && + + git update-ref refs/notes/r refs/notes/b && + git -c core.notesRef=refs/notes/r notes add -f -m r initial && + + git update-ref refs/notes/l refs/notes/b && + git config core.notesRef refs/notes/l && + git notes add -f -m l initial && + + test_must_fail git notes merge r && + ! grep -E "\|+" .git/NOTES_MERGE_WORKTREE/* && + + git notes merge --abort && + test_must_fail git -c merge.conflictstyle=diff3 notes merge r && + grep -E "\|+" .git/NOTES_MERGE_WORKTREE/* && + + git notes merge --abort && + test_must_fail git -c merge.conflictstyle=merge notes merge r && + ! grep -E "\|+" .git/NOTES_MERGE_WORKTREE/* + ) +' + test_done From patchwork Wed Jun 9 19:28:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12311137 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 ADD33C48BCD for ; Wed, 9 Jun 2021 19:30:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8C94D613FE for ; Wed, 9 Jun 2021 19:30:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229941AbhFITcK (ORCPT ); Wed, 9 Jun 2021 15:32:10 -0400 Received: from mail-oi1-f173.google.com ([209.85.167.173]:36518 "EHLO mail-oi1-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229770AbhFITcI (ORCPT ); Wed, 9 Jun 2021 15:32:08 -0400 Received: by mail-oi1-f173.google.com with SMTP id a21so26265504oiw.3 for ; Wed, 09 Jun 2021 12:30:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zGFFGAFQ5vVRP5dlLhyMbBL6ZllOMkvKR1U/z7h6pxM=; b=sQ6Xgmu3Qb4tqWMcIvcP+B9efgxvEWuvpwHtqiSV05xO77mFWsd0rx6N4pSTAZdaSD qzTg9w3Z06O/o3vCM1duBx7X3edmk4XzXSSqYSm/J6xK/7xOmTz6Lgb3cc3lTcYG2vHu K5TyRcr+bvNvlhUcw/oD3063eeSrMargPF/K37D41XQZJOso4UnHlXvPyL41F47VaSHh Pi+hF+2sN/0HHRSV6HKoxMOcGmDJ2W+sLk+xb0jIBIWEXiesWUveLi7GaAI7zJe6v7A5 /WtYkF0/24J8TAJ3pLpaezHa9ly2+VVW012Sbapc6/QDfxFLkvLqQQmCiNUdgIoqpMmp /ddw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zGFFGAFQ5vVRP5dlLhyMbBL6ZllOMkvKR1U/z7h6pxM=; b=cfRUMkEajwaDhIo32wWDLjdodQd4IlXSQkzigNKgGXymrmii4fG6p4AtyYyh/B2sYb OQh88XbGQHr/7jJuiieOZ407mDWYpYc6QL2z7ncheDbvLWIuKMfhia53Faa9U/dP8iBq nwk/rKvy2V1kEssGwqhiJp3+8eHzpNr/Zi93m3sFts21er3G1SuSESRLR6EzsqLQIlIo NgxczSM+qOWZ6PgE4icRvX7/JnNtYoEY0whCdIJS0VVNxPEfbUVVJNb5kx8+6QUnmlv4 ei2N8KWoaF9SGzVCSKSMj7Wl0Db+jI9Nfkj6ycNBQnR8kfNq7ebKFc2FVUVMcJdR7g/e dHJw== X-Gm-Message-State: AOAM530GVe0aj7qucFtHBbqdJmqwQUyF40/am/6z3+ZvDS8Ulj2T/4aK ezTzeWWBTYWp3gSkQ3ew+46dUUUTHNdp7w== X-Google-Smtp-Source: ABdhPJwrf+kGR3UNVH+Upl7vtjAcBU4KwlnU5ZKYH3txjE5PvbBgSHZCc8rfrxy3/uSFi+rHJfklXw== X-Received: by 2002:a05:6808:985:: with SMTP id a5mr7477585oic.42.1623266941051; Wed, 09 Jun 2021 12:29:01 -0700 (PDT) Received: from localhost (fixed-187-188-155-231.totalplay.net. [187.188.155.231]) by smtp.gmail.com with ESMTPSA id p25sm128446ood.4.2021.06.09.12.29.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 12:29:00 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: David Aguilar , Junio C Hamano , Sergey Organov , Bagas Sanjaya , Elijah Newren , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFy?= =?utf-8?b?bWFzb24=?= , Denton Liu , Felipe Contreras Subject: [PATCH 4/7] checkout: fix merge.conflictstyle handling Date: Wed, 9 Jun 2021 14:28:39 -0500 Message-Id: <20210609192842.696646-5-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0.2.g41be0a4e50 In-Reply-To: <20210609192842.696646-1-felipe.contreras@gmail.com> References: <20210609192842.696646-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Currently both merge.conflictStyle and `git commit --merge --conflict=diff3` don't work together, since the former wrongly overrides the later. The way merge configurations are handled is not correct. It should be possible to do git_config(merge_recursive_config, ...) just like we can with git_diff_basic_config and others. Therefore builtins like `git merge` can't call this function at the right time. We shuffle the functions a little bit so at least merge_recursive_config doesn't call git_xmerge_config directly and thus override previous configurations. Signed-off-by: Felipe Contreras --- builtin/merge-recursive.c | 3 +++ builtin/merge.c | 4 ++++ merge-recursive.c | 2 +- sequencer.c | 5 +++++ t/t6440-config-conflict-markers.sh | 31 ++++++++++++++++++++++++++++++ 5 files changed, 44 insertions(+), 1 deletion(-) diff --git a/builtin/merge-recursive.c b/builtin/merge-recursive.c index a4bfd8fc51..80f9279b4c 100644 --- a/builtin/merge-recursive.c +++ b/builtin/merge-recursive.c @@ -4,6 +4,7 @@ #include "tag.h" #include "merge-recursive.h" #include "xdiff-interface.h" +#include "config.h" static const char builtin_merge_recursive_usage[] = "git %s ... -- ..."; @@ -30,6 +31,8 @@ int cmd_merge_recursive(int argc, const char **argv, const char *prefix) char *better1, *better2; struct commit *result; + git_config(git_xmerge_config, NULL); + init_merge_options(&o, the_repository); if (argv[0] && ends_with(argv[0], "-subtree")) o.subtree_shift = ""; diff --git a/builtin/merge.c b/builtin/merge.c index eddb8ae70d..7aa3dbb111 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -43,6 +43,7 @@ #include "commit-reach.h" #include "wt-status.h" #include "commit-graph.h" +#include "xdiff-interface.h" #define DEFAULT_TWOHEAD (1<<0) #define DEFAULT_OCTOPUS (1<<1) @@ -659,6 +660,9 @@ static int git_merge_config(const char *k, const char *v, void *cb) if (status) return status; status = git_gpg_config(k, v, NULL); + if (status) + return status; + status = git_xmerge_config(k, v, NULL); if (status) return status; return git_diff_ui_config(k, v, cb); diff --git a/merge-recursive.c b/merge-recursive.c index d146bb116f..10e6e1e4d1 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -3845,7 +3845,7 @@ static void merge_recursive_config(struct merge_options *opt) } /* avoid erroring on values from future versions of git */ free(value); } - git_config(git_xmerge_config, NULL); + git_config(git_default_config, NULL); } void init_merge_options(struct merge_options *opt, diff --git a/sequencer.c b/sequencer.c index 0bec01cf38..9e2bdca0f6 100644 --- a/sequencer.c +++ b/sequencer.c @@ -34,6 +34,7 @@ #include "commit-reach.h" #include "rebase-interactive.h" #include "reset.h" +#include "xdiff-interface.h" #define GIT_REFLOG_ACTION "GIT_REFLOG_ACTION" @@ -224,6 +225,10 @@ static int git_sequencer_config(const char *k, const char *v, void *cb) if (status) return status; + status = git_xmerge_config(k, v, NULL); + if (status) + return status; + return git_diff_basic_config(k, v, NULL); } diff --git a/t/t6440-config-conflict-markers.sh b/t/t6440-config-conflict-markers.sh index 44f79ac91b..485ad0eee0 100755 --- a/t/t6440-config-conflict-markers.sh +++ b/t/t6440-config-conflict-markers.sh @@ -89,4 +89,35 @@ test_expect_success 'notes' ' ) ' +test_expect_success 'checkout' ' + test_create_repo checkout && + ( + test_commit checkout && + + fill a b c d e >content && + git add content && + git commit -m initial && + + git checkout -b simple master && + fill a c e >content && + git commit -a -m simple && + + fill b d >content && + git checkout --merge master && + ! grep -E "\|+" content && + + git config merge.conflictstyle merge && + + git checkout -f simple && + fill b d >content && + git checkout --merge --conflict=diff3 master && + grep -E "\|+" content && + + git checkout -f simple && + fill b d >content && + git checkout --merge --conflict=merge master && + ! grep -E "\|+" content + ) +' + test_done From patchwork Wed Jun 9 19:28:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12311129 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 5EA68C48BCD for ; Wed, 9 Jun 2021 19:29:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 432A4613F9 for ; Wed, 9 Jun 2021 19:29:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229931AbhFITbO (ORCPT ); Wed, 9 Jun 2021 15:31:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229499AbhFITbN (ORCPT ); Wed, 9 Jun 2021 15:31:13 -0400 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D058C061574 for ; Wed, 9 Jun 2021 12:29:04 -0700 (PDT) Received: by mail-ot1-x32c.google.com with SMTP id 102-20020a9d0eef0000b02903fccc5b733fso2043542otj.4 for ; Wed, 09 Jun 2021 12:29:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dur5G+hLZo+ar4ECS1kdwGrRIjsqjsURTMLNP5itG/c=; b=FrjMGKmuVBB19bVRoX98jvvnVygishV5VCGghPG6b6gsnNaEDEA8wNBXAwhIq2jgDT t9TKnq9fVj/UPbur6QLCPTD/kb/Q4D2B/V7nlF+4KJxODwIVor1quQvdOmAvt+QanG9M P+odyES+5xq+R/Shnqc5mjd4NZkbWEdEYkNaZ+M57taCjIjj9B1jIGqOQ4TnT5CRqo93 6nZ6dPmwXQTfp0cDn+PsD69NKKUFVxotwg+hKzrGxEXn0TgeTDiWRNeA9zwyBdlYXBld UwMshUWHAZw0OF79yElP7OBaa5hWuzElX8aLhZY0UbVOsXUpi+X9CGbX/HvcXXowLqn9 kfdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dur5G+hLZo+ar4ECS1kdwGrRIjsqjsURTMLNP5itG/c=; b=skBoyJrd3oVzwaSuov4p0uV00kfq2NeA/JHkkjeX0LVNNv/FjyfcGVNMTN4B5KJ7kM QaRBfs1kwe1XtEGDpCQfFpqA5xmnbq4cqsXo6dmnqj1hZTaQEEwsuBlFFgOXmVNFHUxJ HDavCU1CIJaZ591+TzlEaBd1AyOt+GYj0jbjx65y71UzW08TzaJkl6TgxMJ5Fb//pVOu JeBQbZFqlbM8/aNbZlyFvHUc2tElneTwU65D7XwvoNrjinivurvY8VgWC5VjXyGYrMiW nqenb3q3zGRBY230agUlG5XewYanIYCGHIOUUVncTl+s67TcjoB1DFoEutNo2oLIpMxM y62Q== X-Gm-Message-State: AOAM531iJ4UahfbGzPIiORbEcRX0k5HLg1K3hS4vsYCP1qLJQdiKNb+s XhF8kvK8u+jyWn4Wlcy/ecXiD0SlCa0NpA== X-Google-Smtp-Source: ABdhPJwuVbkoQclPfRu8VeUM5nCvgcCJ9Niocp+wEKnnSRncQphm3aw5X6puRN84U37kjMhAWPytow== X-Received: by 2002:a05:6830:11c8:: with SMTP id v8mr831886otq.152.1623266942765; Wed, 09 Jun 2021 12:29:02 -0700 (PDT) Received: from localhost (fixed-187-188-155-231.totalplay.net. [187.188.155.231]) by smtp.gmail.com with ESMTPSA id p5sm135333oip.35.2021.06.09.12.29.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 12:29:02 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: David Aguilar , Junio C Hamano , Sergey Organov , Bagas Sanjaya , Elijah Newren , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFy?= =?utf-8?b?bWFzb24=?= , Denton Liu , Felipe Contreras Subject: [PATCH 5/7] xdiff: rename XDL_MERGE_STYLE_DIFF3 Date: Wed, 9 Jun 2021 14:28:40 -0500 Message-Id: <20210609192842.696646-6-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0.2.g41be0a4e50 In-Reply-To: <20210609192842.696646-1-felipe.contreras@gmail.com> References: <20210609192842.696646-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org If we don't specify we are talking about a style, XDL_MERGE_MINIMAL could be confused with a valid value instead of XDL_MERGE_DIFF3, which it isn't. Signed-off-by: Felipe Contreras --- builtin/merge-file.c | 2 +- xdiff-interface.c | 2 +- xdiff/xdiff.h | 2 +- xdiff/xmerge.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/builtin/merge-file.c b/builtin/merge-file.c index 06a2f90c48..a4097a596f 100644 --- a/builtin/merge-file.c +++ b/builtin/merge-file.c @@ -33,7 +33,7 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix) int quiet = 0; struct option options[] = { OPT_BOOL('p', "stdout", &to_stdout, N_("send results to standard output")), - OPT_SET_INT(0, "diff3", &xmp.style, N_("use a diff3 based merge"), XDL_MERGE_DIFF3), + OPT_SET_INT(0, "diff3", &xmp.style, N_("use a diff3 based merge"), XDL_MERGE_STYLE_DIFF3), OPT_SET_INT(0, "ours", &xmp.favor, N_("for conflicts, use our version"), XDL_MERGE_FAVOR_OURS), OPT_SET_INT(0, "theirs", &xmp.favor, N_("for conflicts, use their version"), diff --git a/xdiff-interface.c b/xdiff-interface.c index 609615db2c..64e2c4e301 100644 --- a/xdiff-interface.c +++ b/xdiff-interface.c @@ -307,7 +307,7 @@ int git_xmerge_config(const char *var, const char *value, void *cb) if (!value) die("'%s' is not a boolean", var); if (!strcmp(value, "diff3")) - git_xmerge_style = XDL_MERGE_DIFF3; + git_xmerge_style = XDL_MERGE_STYLE_DIFF3; else if (!strcmp(value, "merge")) git_xmerge_style = 0; /* diff --git a/xdiff/xdiff.h b/xdiff/xdiff.h index 7a04605146..45883f5eb3 100644 --- a/xdiff/xdiff.h +++ b/xdiff/xdiff.h @@ -64,7 +64,7 @@ extern "C" { #define XDL_MERGE_FAVOR_UNION 3 /* merge output styles */ -#define XDL_MERGE_DIFF3 1 +#define XDL_MERGE_STYLE_DIFF3 1 typedef struct s_mmfile { char *ptr; diff --git a/xdiff/xmerge.c b/xdiff/xmerge.c index 1659edb453..f6916a4ba4 100644 --- a/xdiff/xmerge.c +++ b/xdiff/xmerge.c @@ -230,7 +230,7 @@ static int fill_conflict_hunk(xdfenv_t *xe1, const char *name1, size += xdl_recs_copy(xe1, m->i1, m->chg1, needs_cr, 1, dest ? dest + size : NULL); - if (style == XDL_MERGE_DIFF3) { + if (style == XDL_MERGE_STYLE_DIFF3) { /* Shared preimage */ if (!dest) { size += marker_size + 1 + needs_cr + marker3_size; @@ -482,7 +482,7 @@ static int xdl_do_merge(xdfenv_t *xe1, xdchange_t *xscr1, int style = xmp->style; int favor = xmp->favor; - if (style == XDL_MERGE_DIFF3) { + if (style == XDL_MERGE_STYLE_DIFF3) { /* * "diff3 -m" output does not make sense for anything * more aggressive than XDL_MERGE_EAGER. From patchwork Wed Jun 9 19:28:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12311131 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 2534DC48BCD for ; Wed, 9 Jun 2021 19:30:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 02363613F9 for ; Wed, 9 Jun 2021 19:30:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229655AbhFITcA (ORCPT ); Wed, 9 Jun 2021 15:32:00 -0400 Received: from mail-oi1-f178.google.com ([209.85.167.178]:37653 "EHLO mail-oi1-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229499AbhFITb7 (ORCPT ); Wed, 9 Jun 2021 15:31:59 -0400 Received: by mail-oi1-f178.google.com with SMTP id h9so26253280oih.4 for ; Wed, 09 Jun 2021 12:30:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gvAj1Rn/wiZgZDEYBBgOL/XNTbxoaGL0IGVkBRLllaI=; b=VUyCnLVWpkFtDoheuui+y5GpLrSl1LK432+yuodrwYIxQY26z8kApWdyTPlyr+tQ55 W2fUASPCdfzkATR3DmDjcYEHRutK6zArwGtWXh1WE9DnRDtMjg7d4uHArEBC3IKEtQdR Msggzt/sFKzQv1yfU/XPItvnohoCu6kHGeL1QESrB8koUK/U/CLuCMm722R2er+8v+c7 I7kWZ5Iy4jD172YyVYX/cNJXbXdBLi7BL93cGSqDkrJT2r7VU3ONrXWVCtQ3SnHQ4Hz+ OMwRYt5oEyJIo/PCQ2ZJitFonng7j9ZfA7Y/2MLFi8CRG6Kd23slELJvqskTLX/EwQfJ aHZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gvAj1Rn/wiZgZDEYBBgOL/XNTbxoaGL0IGVkBRLllaI=; b=OPSQTdvYHi4wqP0NpvV3KZtaKoFg9iR/yA8emboi9xaeunG+34HR2viYgTh8E6i21m TMHarGYfrFGRrzPn+U81l5DCBvkfxcAnEcYoma0SlOCjpfo7MMQpqMc8jNmIjfw9lb87 IGdmlPiOghzxdmscGMbTILnW1lWRr5DsXJVU/LOXFtKFEf/UMJlAisrjDcw4tq09Hw1I 86IGolcjU2wXvgz64QXPmVQEU7DxQXoFlPllcq81Oa6Hf205fZHcdK95eAXLc20Lm3k4 Fp2WZBEwUPR/xsfgvcLrdBLk0JDZN+fX/gEBfuhhjDaksrusFVBrKaiJhz7NthIRyRbu 4fmA== X-Gm-Message-State: AOAM531UQdZVfsVkLGisha5pcfvkOlIvyTHNCcYKxUHfixWTeJLaNXIo YX7MIsN2LB7QyNGjXLnVo3x8MClLZMveOg== X-Google-Smtp-Source: ABdhPJzbiucFV+U8b/QK2spphz+0kV7axtBo+W9x0yqTkHfVcV5dGrpaG8bpX1flDddLQGxXs7LKcQ== X-Received: by 2002:aca:efc1:: with SMTP id n184mr7585380oih.23.1623266944335; Wed, 09 Jun 2021 12:29:04 -0700 (PDT) Received: from localhost (fixed-187-188-155-231.totalplay.net. [187.188.155.231]) by smtp.gmail.com with ESMTPSA id z4sm185824otq.48.2021.06.09.12.29.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 12:29:04 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: David Aguilar , Junio C Hamano , Sergey Organov , Bagas Sanjaya , Elijah Newren , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFy?= =?utf-8?b?bWFzb24=?= , Denton Liu , Felipe Contreras Subject: [PATCH 6/7] xdiff: simplify style assignments Date: Wed, 9 Jun 2021 14:28:41 -0500 Message-Id: <20210609192842.696646-7-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0.2.g41be0a4e50 In-Reply-To: <20210609192842.696646-1-felipe.contreras@gmail.com> References: <20210609192842.696646-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org There is little value in checking that git_xmerge_style isn't 0 before changing it's default value. Most of the time it isn't 0 anyway, so just assign the value directly. Also, add the missing constant for the default value: XDL_MERGE_STYLE_MERGE. Additionally this change has the benefit that it gets rid of a Yoda condition. No functional changes. Signed-off-by: Felipe Contreras --- builtin/merge-file.c | 3 +-- ll-merge.c | 3 +-- xdiff-interface.c | 4 ++-- xdiff/xdiff.h | 1 + 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/builtin/merge-file.c b/builtin/merge-file.c index a4097a596f..01951762ec 100644 --- a/builtin/merge-file.c +++ b/builtin/merge-file.c @@ -55,8 +55,7 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix) if (startup_info->have_repository) { /* Read the configuration file */ git_config(git_xmerge_config, NULL); - if (0 <= git_xmerge_style) - xmp.style = git_xmerge_style; + xmp.style = git_xmerge_style; } argc = parse_options(argc, argv, prefix, options, merge_file_usage, 0); diff --git a/ll-merge.c b/ll-merge.c index 9a8a2c365c..4ce8d3f9cc 100644 --- a/ll-merge.c +++ b/ll-merge.c @@ -124,8 +124,7 @@ static int ll_xdl_merge(const struct ll_merge_driver *drv_unused, xmp.level = XDL_MERGE_ZEALOUS; xmp.favor = opts->variant; xmp.xpp.flags = opts->xdl_opts; - if (git_xmerge_style >= 0) - xmp.style = git_xmerge_style; + xmp.style = git_xmerge_style; if (marker_size > 0) xmp.marker_size = marker_size; xmp.ancestor = orig_name; diff --git a/xdiff-interface.c b/xdiff-interface.c index 64e2c4e301..19a030fbe2 100644 --- a/xdiff-interface.c +++ b/xdiff-interface.c @@ -299,7 +299,7 @@ int xdiff_compare_lines(const char *l1, long s1, return xdl_recmatch(l1, s1, l2, s2, flags); } -int git_xmerge_style = -1; +int git_xmerge_style = XDL_MERGE_STYLE_MERGE; int git_xmerge_config(const char *var, const char *value, void *cb) { @@ -309,7 +309,7 @@ int git_xmerge_config(const char *var, const char *value, void *cb) if (!strcmp(value, "diff3")) git_xmerge_style = XDL_MERGE_STYLE_DIFF3; else if (!strcmp(value, "merge")) - git_xmerge_style = 0; + git_xmerge_style = XDL_MERGE_STYLE_MERGE; /* * Please update _git_checkout() in * git-completion.bash when you add new merge config diff --git a/xdiff/xdiff.h b/xdiff/xdiff.h index 45883f5eb3..d24cd9f6ae 100644 --- a/xdiff/xdiff.h +++ b/xdiff/xdiff.h @@ -64,6 +64,7 @@ extern "C" { #define XDL_MERGE_FAVOR_UNION 3 /* merge output styles */ +#define XDL_MERGE_STYLE_MERGE 0 #define XDL_MERGE_STYLE_DIFF3 1 typedef struct s_mmfile { From patchwork Wed Jun 9 19:28:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12311127 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 D61D2C48BCF for ; Wed, 9 Jun 2021 19:29:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B9B86613FE for ; Wed, 9 Jun 2021 19:29:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229788AbhFITbC (ORCPT ); Wed, 9 Jun 2021 15:31:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229499AbhFITbC (ORCPT ); Wed, 9 Jun 2021 15:31:02 -0400 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2059DC06175F for ; Wed, 9 Jun 2021 12:29:07 -0700 (PDT) Received: by mail-ot1-x32c.google.com with SMTP id l15-20020a05683016cfb02903fca0eacd15so1168468otr.7 for ; Wed, 09 Jun 2021 12:29:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HZm2M7K1HVTYuM7R6FtXmJPCbIRnDeK1ZUMAVnj+u04=; b=LJGZ6gagnJU6dvKBXkiWlKr6GgfRG3Wg08JFy5C8avMjAGx4tVQMiJW3cY327iGBoi 5YvmacxknV54b3k1vUHgJAZGYH35QDxXtZE/Xgbsc/E/u2iG7mCtBkiXxt3z+GP4G9cU 251dit5qO6uC8XGIyuC7oI9Cq97rnsvncroFz/EJVtcz76ks6d7gwvXUmxZiC8iEcY7z Hj/NaxvONZoHWuk/7x9cMo/aSt3RWmxlRqZ3TlCNuI63GTPF2DyTz7T8U4PRK87M9+KL Yb6bXN+mBP8arOa7l1MQPIPTM+LwGyI9sKwxVvOro5e3JVOsqxVMEzBomtQYH+Tkr2cz kkAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HZm2M7K1HVTYuM7R6FtXmJPCbIRnDeK1ZUMAVnj+u04=; b=OOpCuG6cFzUut3KOPkP2+mcYiqExKozJJ73PUcvaOIWaPTGIixWnOY5XT+3D30CsHE AqlpbqyqLASgOrUsUx1oumpvl3tRGRz4sutZ6req9smicEFiDbKntwxeZUSn8W+BSFPz ikmqoddue5hwG3OOxCr4gWwEUVfGDHFj7oYMgGPxvr3gr+JRgpCXW9djWYkTyLC3m6A5 a1DhpaqWsF+XFGp6nd7hTIr/adR2HGvZb9pMMMLdG24yjwGpjXOIJbB2Sv1IEYR9zI59 DnQzu2zvhXhn4i56V4xz2H80cEr04d5AMQ97XCBzcX8xkz8qmf7yQ2WGrH98gCbhxLvZ I4PA== X-Gm-Message-State: AOAM530nHxC/Ik/6X7sTr4xN2QDJ5r0db+YYkpEc6QB64FopprpheHsW U+/DjWxHvd0aw5NYINhe1Biz39R2uyi0LA== X-Google-Smtp-Source: ABdhPJxtFry0uzdhQpkf0HegrDDJrkSUxWl4H/ANQqtYarLX73NXfAiB2QJ6T2tIV52tAem4xZZGDw== X-Received: by 2002:a9d:206:: with SMTP id 6mr873462otb.31.1623266945998; Wed, 09 Jun 2021 12:29:05 -0700 (PDT) Received: from localhost (fixed-187-188-155-231.totalplay.net. [187.188.155.231]) by smtp.gmail.com with ESMTPSA id w13sm175809otp.10.2021.06.09.12.29.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 12:29:05 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: David Aguilar , Junio C Hamano , Sergey Organov , Bagas Sanjaya , Elijah Newren , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFy?= =?utf-8?b?bWFzb24=?= , Denton Liu , Felipe Contreras Subject: [PATCH 7/7] xdiff: make diff3 the default conflictStyle Date: Wed, 9 Jun 2021 14:28:42 -0500 Message-Id: <20210609192842.696646-8-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0.2.g41be0a4e50 In-Reply-To: <20210609192842.696646-1-felipe.contreras@gmail.com> References: <20210609192842.696646-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Virtually everyone is using it, and it's one of the first things we teach newcomers in order to resolve conflicts efficiently. Let's make it the default. This generates a ton of changes in the tests. Although we probably will want to update them to use th new default, override the configuration so we use the old one for now. Signed-off-by: Felipe Contreras --- Documentation/config/merge.txt | 12 +++++----- Documentation/git-merge-file.txt | 2 ++ Documentation/git-merge.txt | 28 +++++++----------------- Documentation/git-rerere.txt | 2 +- Documentation/gitattributes.txt | 6 ++--- Documentation/technical/rerere.txt | 3 +-- Documentation/user-manual.txt | 6 ++++- t/t2023-checkout-m.sh | 2 ++ t/t3310-notes-merge-manual-resolve.sh | 2 ++ t/t3311-notes-merge-fanout.sh | 2 ++ t/t3404-rebase-interactive.sh | 2 ++ t/t3507-cherry-pick-conflict.sh | 2 ++ t/t4017-diff-retval.sh | 2 ++ t/t4048-diff-combined-binary.sh | 2 ++ t/t4200-rerere.sh | 2 ++ t/t4300-merge-tree.sh | 2 ++ t/t6402-merge-rename.sh | 2 ++ t/t6403-merge-file.sh | 2 ++ t/t6404-recursive-merge.sh | 2 ++ t/t6416-recursive-corner-cases.sh | 2 ++ t/t6417-merge-ours-theirs.sh | 2 ++ t/t6418-merge-text-auto.sh | 2 ++ t/t6422-merge-rename-corner-cases.sh | 2 ++ t/t6423-merge-rename-directories.sh | 1 + t/t6428-merge-conflicts-sparse.sh | 1 + t/t6432-merge-recursive-space-options.sh | 2 ++ t/t6440-config-conflict-markers.sh | 8 +++---- t/t7201-co.sh | 2 ++ t/t7506-status-submodule.sh | 1 + xdiff-interface.c | 2 +- 30 files changed, 70 insertions(+), 38 deletions(-) diff --git a/Documentation/config/merge.txt b/Documentation/config/merge.txt index cb2ed58907..2dba937dd0 100644 --- a/Documentation/config/merge.txt +++ b/Documentation/config/merge.txt @@ -1,10 +1,10 @@ merge.conflictStyle:: - Specify the style in which conflicted hunks are written out to - working tree files upon merge. The default is "merge", which - shows a `<<<<<<<` conflict marker, changes made by one side, - a `=======` marker, changes made by the other side, and then - a `>>>>>>>` marker. An alternate style, "diff3", adds a `|||||||` - marker and the original text before the `=======` marker. + Specify the style in which conflicted hunks are written out to working + tree files upon merge. The default is "diff3", which shows a `<<<<<<<` + conflict marker, changes made by one side, a `|||||||` marker, the + original text, a `=======` marker, changes made by the other side, and + then a `>>>>>>>` marker. A simpler mode "merge" omits the `|||||||` + marker and the original text. merge.defaultToUpstream:: If merge is called without any commit argument, merge the upstream diff --git a/Documentation/git-merge-file.txt b/Documentation/git-merge-file.txt index f856032613..7d8e74c872 100644 --- a/Documentation/git-merge-file.txt +++ b/Documentation/git-merge-file.txt @@ -30,6 +30,8 @@ normally outputs a warning and brackets the conflict with lines containing <<<<<<< A lines in file A + ||||||| + lines in merge base ======= lines in file B >>>>>>> B diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt index 3819fadac1..14dadf2e16 100644 --- a/Documentation/git-merge.txt +++ b/Documentation/git-merge.txt @@ -233,7 +233,7 @@ final result verbatim. When both sides made changes to the same area, however, Git cannot randomly pick one side over the other, and asks you to resolve it by leaving what both sides did to that area. -By default, Git uses the same style as the one used by the "merge" program +By default, Git uses a similar style to the one used by the "merge" program from the RCS suite to present such a conflicted hunk, like this: ------------ @@ -242,6 +242,8 @@ ancestor, or cleanly resolved because only one side changed. <<<<<<< yours:sample.txt Conflict resolution is hard; let's go shopping. +||||||| +Originally there's no conflict. ======= Git makes conflict resolution easy. >>>>>>> theirs:sample.txt @@ -249,17 +251,12 @@ And here is another line that is cleanly resolved or unmodified. ------------ The area where a pair of conflicting changes happened is marked with markers -`<<<<<<<`, `=======`, and `>>>>>>>`. The part before the `=======` -is typically your side, and the part afterwards is typically their side. - -The default format does not show what the original said in the conflicting -area. You cannot tell how many lines are deleted and replaced with -Barbie's remark on your side. The only thing you can tell is that your -side wants to say it is hard and you'd prefer to go shopping, while the -other side wants to claim it is easy. +`<<<<<<<`, `=======`, and `>>>>>>>`. The part before the `|||||||` +is typically your side, and the part after `=======` is typically their side. +In-between is the original code. -An alternative style can be used by setting the "merge.conflictStyle" -configuration variable to "diff3". In "diff3" style, the above conflict +An more basic style can be used by setting the "merge.conflictStyle" +configuration variable to "merge". In "merge" style, the above conflict may look like this: ------------ @@ -268,21 +265,12 @@ ancestor, or cleanly resolved because only one side changed. <<<<<<< yours:sample.txt Conflict resolution is hard; let's go shopping. -||||||| -Conflict resolution is hard. ======= Git makes conflict resolution easy. >>>>>>> theirs:sample.txt And here is another line that is cleanly resolved or unmodified. ------------ -In addition to the `<<<<<<<`, `=======`, and `>>>>>>>` markers, it uses -another `|||||||` marker that is followed by the original text. You can -tell that the original just stated a fact, and your side simply gave in to -that statement and gave up, while the other side tried to have a more -positive attitude. You can sometimes come up with a better resolution by -viewing the original. - HOW TO RESOLVE CONFLICTS ------------------------ diff --git a/Documentation/git-rerere.txt b/Documentation/git-rerere.txt index 4cfc883378..89b0820995 100644 --- a/Documentation/git-rerere.txt +++ b/Documentation/git-rerere.txt @@ -159,7 +159,7 @@ resolve. Running the 'git rerere' command immediately after a conflicted automerge records the conflicted working tree files, with the -usual conflict markers `<<<<<<<`, `=======`, and `>>>>>>>` in +usual conflict markers `<<<<<<<`, `|||||||`, `=======`, and `>>>>>>>` in them. Later, after you are done resolving the conflicts, running 'git rerere' again will record the resolved state of these files. Suppose you did this when you created the test merge of diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 83fd4e19a4..b767215ac2 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -1042,10 +1042,10 @@ text:: Usual 3-way file level merge for text files. Conflicted regions are marked with conflict markers `<<<<<<<`, - `=======` and `>>>>>>>`. The version from your branch - appears before the `=======` marker, and the version + `|||||||`, `=======` and `>>>>>>>`. The version from your branch + appears before the `|||||||` marker, and the version from the merged branch appears after the `=======` - marker. + marker. In-between is the original. binary:: diff --git a/Documentation/technical/rerere.txt b/Documentation/technical/rerere.txt index af5f9fc24f..38b44f4430 100644 --- a/Documentation/technical/rerere.txt +++ b/Documentation/technical/rerere.txt @@ -42,8 +42,7 @@ get a conflict like the following: >>>>>>> AC Doing the analogous with AC2 (forking a branch ABAC2 off of branch AB -and then merging branch AC2 into it), using the diff3 conflict style, -we get a conflict like the following: +and then merging branch AC2 into it), we get a conflict like the following: <<<<<<< HEAD B diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt index f9e54b8674..3ddde87482 100644 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@ -1243,6 +1243,8 @@ files with conflicts will have conflict markers added, like this: ------------------------------------------------- <<<<<<< HEAD:file.txt Hello world +||||||| +Original ======= Goodbye >>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt @@ -1276,9 +1278,11 @@ diff --cc file.txt index 802992c,2b60207..0000000 --- a/file.txt +++ b/file.txt -@@@ -1,1 -1,1 +1,5 @@@ +@@@ -1,1 -1,1 +1,7 @@@ ++<<<<<<< HEAD:file.txt +Hello world +++||||||| +++Original ++======= + Goodbye ++>>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt diff --git a/t/t2023-checkout-m.sh b/t/t2023-checkout-m.sh index 7b327b7544..219c82532a 100755 --- a/t/t2023-checkout-m.sh +++ b/t/t2023-checkout-m.sh @@ -9,6 +9,8 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . ./test-lib.sh +git config merge.conflictstyle merge # TODO: use the default + test_expect_success setup ' test_tick && test_commit both.txt both.txt initial && diff --git a/t/t3310-notes-merge-manual-resolve.sh b/t/t3310-notes-merge-manual-resolve.sh index d3d72e25fe..cbd5d8302e 100755 --- a/t/t3310-notes-merge-manual-resolve.sh +++ b/t/t3310-notes-merge-manual-resolve.sh @@ -7,6 +7,8 @@ test_description='Test notes merging with manual conflict resolution' . ./test-lib.sh +git config --global merge.conflictstyle merge # TODO: use the default + # Set up a notes merge scenario with different kinds of conflicts test_expect_success 'setup commits' ' test_commit 1st && diff --git a/t/t3311-notes-merge-fanout.sh b/t/t3311-notes-merge-fanout.sh index 5b675417e9..4aeaa05c15 100755 --- a/t/t3311-notes-merge-fanout.sh +++ b/t/t3311-notes-merge-fanout.sh @@ -7,6 +7,8 @@ test_description='Test notes merging at various fanout levels' . ./test-lib.sh +git config merge.conflictstyle merge # TODO: use the default + verify_notes () { notes_ref="$1" commit="$2" diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 66bcbbf952..769079a71c 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -32,6 +32,8 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . "$TEST_DIRECTORY"/lib-rebase.sh +git config merge.conflictstyle merge # TODO: use the default + test_expect_success 'setup' ' git switch -C primary && test_commit A file1 && diff --git a/t/t3507-cherry-pick-conflict.sh b/t/t3507-cherry-pick-conflict.sh index 014001b8f3..647a40f314 100755 --- a/t/t3507-cherry-pick-conflict.sh +++ b/t/t3507-cherry-pick-conflict.sh @@ -281,6 +281,7 @@ test_expect_success \ test_expect_success 'failed cherry-pick describes conflict in work tree' ' pristine_detach initial && + git config merge.conflictstyle merge && # TODO: use the default cat <<-EOF >expected && <<<<<<< HEAD a @@ -316,6 +317,7 @@ test_expect_success 'diff3 -m style' ' test_expect_success 'revert also handles conflicts sanely' ' git config --unset merge.conflictstyle && + git config merge.conflictstyle merge && # TODO: use the default pristine_detach initial && cat <<-EOF >expected && <<<<<<< HEAD diff --git a/t/t4017-diff-retval.sh b/t/t4017-diff-retval.sh index ed461f481e..04b77af2a4 100755 --- a/t/t4017-diff-retval.sh +++ b/t/t4017-diff-retval.sh @@ -7,6 +7,8 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . ./test-lib.sh +git config merge.conflictstyle merge # TODO: use the default + test_expect_success 'setup' ' echo "1 " >a && git add . && diff --git a/t/t4048-diff-combined-binary.sh b/t/t4048-diff-combined-binary.sh index 0260cf64f5..49a56731dd 100755 --- a/t/t4048-diff-combined-binary.sh +++ b/t/t4048-diff-combined-binary.sh @@ -6,6 +6,8 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . ./test-lib.sh +git config merge.conflictstyle merge # TODO: use the default + test_expect_success 'setup binary merge conflict' ' echo oneQ1 | q_to_nul >binary && git add binary && diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh index 9f8c76dffb..e9ae3d6fde 100755 --- a/t/t4200-rerere.sh +++ b/t/t4200-rerere.sh @@ -27,6 +27,8 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . ./test-lib.sh +git config merge.conflictstyle merge # TODO: use the default + test_expect_success 'setup' ' cat >a1 <<-\EOF && Some title diff --git a/t/t4300-merge-tree.sh b/t/t4300-merge-tree.sh index e59601e5fe..f21ccaf0a6 100755 --- a/t/t4300-merge-tree.sh +++ b/t/t4300-merge-tree.sh @@ -6,6 +6,8 @@ test_description='git merge-tree' . ./test-lib.sh +git config merge.conflictstyle merge # TODO: use the default + test_expect_success setup ' test_commit "initial" "initial-file" "initial" ' diff --git a/t/t6402-merge-rename.sh b/t/t6402-merge-rename.sh index 425dad97d5..4f01bbc451 100755 --- a/t/t6402-merge-rename.sh +++ b/t/t6402-merge-rename.sh @@ -270,6 +270,7 @@ test_expect_success 'setup for rename + d/f conflicts' ' git checkout --orphan dir-in-way && git rm -rf . && git clean -fdqx && + git config merge.conflictstyle merge && # TODO: use the default mkdir sub && mkdir dir && @@ -871,6 +872,7 @@ test_expect_success 'setup for use of extended merge markers' ' git clean -fdqx && rm -rf .git && git init && + git config merge.conflictstyle merge && # TODO: use the default printf "1\n2\n3\n4\n5\n6\n7\n8\n" >original_file && git add original_file && diff --git a/t/t6403-merge-file.sh b/t/t6403-merge-file.sh index 2f421d967a..1428dfb5c6 100755 --- a/t/t6403-merge-file.sh +++ b/t/t6403-merge-file.sh @@ -3,6 +3,8 @@ test_description='RCS merge replacement: merge-file' . ./test-lib.sh +git config merge.conflictstyle merge # TODO: use the default + test_expect_success 'setup' ' cat >orig.txt <<-\EOF && Dominus regit me, diff --git a/t/t6404-recursive-merge.sh b/t/t6404-recursive-merge.sh index eaf48e941e..a3354b8f9a 100755 --- a/t/t6404-recursive-merge.sh +++ b/t/t6404-recursive-merge.sh @@ -6,6 +6,8 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . ./test-lib.sh +git config merge.conflictstyle merge # TODO: use the default + # This scenario is based on a real-world repository of Shawn Pearce. # 1 - A - D - F diff --git a/t/t6416-recursive-corner-cases.sh b/t/t6416-recursive-corner-cases.sh index 84f5082366..ac4e69a325 100755 --- a/t/t6416-recursive-corner-cases.sh +++ b/t/t6416-recursive-corner-cases.sh @@ -8,6 +8,8 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . ./test-lib.sh . "$TEST_DIRECTORY"/lib-merge.sh +git config --global merge.conflictstyle merge # TODO: use the default + # # L1 L2 # o---o diff --git a/t/t6417-merge-ours-theirs.sh b/t/t6417-merge-ours-theirs.sh index ac9aee9a66..b8208a383b 100755 --- a/t/t6417-merge-ours-theirs.sh +++ b/t/t6417-merge-ours-theirs.sh @@ -6,6 +6,8 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . ./test-lib.sh +git config merge.conflictstyle merge # TODO: use the default + test_expect_success setup ' for i in 1 2 3 4 5 6 7 8 9 do diff --git a/t/t6418-merge-text-auto.sh b/t/t6418-merge-text-auto.sh index 1e0296dd17..e18f67776c 100755 --- a/t/t6418-merge-text-auto.sh +++ b/t/t6418-merge-text-auto.sh @@ -17,6 +17,8 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . ./test-lib.sh +git config merge.conflictstyle merge # TODO: use the default + test_have_prereq SED_STRIPS_CR && SED_OPTIONS=-b compare_files () { diff --git a/t/t6422-merge-rename-corner-cases.sh b/t/t6422-merge-rename-corner-cases.sh index bf4ce3c63d..6bb4b6d968 100755 --- a/t/t6422-merge-rename-corner-cases.sh +++ b/t/t6422-merge-rename-corner-cases.sh @@ -9,6 +9,8 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . ./test-lib.sh . "$TEST_DIRECTORY"/lib-merge.sh +git config --global merge.conflictstyle merge # TODO: use the default + test_setup_rename_delete_untracked () { test_create_repo rename-delete-untracked && ( diff --git a/t/t6423-merge-rename-directories.sh b/t/t6423-merge-rename-directories.sh index 7134769149..5f6cacd064 100755 --- a/t/t6423-merge-rename-directories.sh +++ b/t/t6423-merge-rename-directories.sh @@ -28,6 +28,7 @@ test_description="recursive merge with directory renames" . ./test-lib.sh . "$TEST_DIRECTORY"/lib-merge.sh +git config --global merge.conflictstyle merge # TODO: use the default ########################################################################### # SECTION 1: Basic cases we should be able to handle diff --git a/t/t6428-merge-conflicts-sparse.sh b/t/t6428-merge-conflicts-sparse.sh index 7e8bf497f8..18975801db 100755 --- a/t/t6428-merge-conflicts-sparse.sh +++ b/t/t6428-merge-conflicts-sparse.sh @@ -25,6 +25,7 @@ test_description="merge cases" . ./test-lib.sh . "$TEST_DIRECTORY"/lib-merge.sh +git config --global merge.conflictstyle merge # TODO: use the default # Testcase basic, conflicting changes in 'numerals' diff --git a/t/t6432-merge-recursive-space-options.sh b/t/t6432-merge-recursive-space-options.sh index db4b77e63d..5cfe8a4fbd 100755 --- a/t/t6432-merge-recursive-space-options.sh +++ b/t/t6432-merge-recursive-space-options.sh @@ -16,6 +16,8 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . ./test-lib.sh +git config merge.conflictstyle merge # TODO: use the default + test_have_prereq SED_STRIPS_CR && SED_OPTIONS=-b if test_have_prereq GREP_STRIPS_CR then diff --git a/t/t6440-config-conflict-markers.sh b/t/t6440-config-conflict-markers.sh index 485ad0eee0..ae0bab37ad 100755 --- a/t/t6440-config-conflict-markers.sh +++ b/t/t6440-config-conflict-markers.sh @@ -29,7 +29,7 @@ test_expect_success 'merge' ' git commit -a -m left && test_must_fail git merge r && - ! grep -E "\|+" content && + grep -E "\|+" content && git reset --hard && test_must_fail git -c merge.conflictstyle=diff3 merge r && @@ -52,7 +52,7 @@ test_expect_success 'merge-tree' ' test_commit l content l && git merge-tree initial r l >actual && - ! grep -E "\|+" actual && + grep -E "\|+" actual && git -c merge.conflictstyle=diff3 merge-tree initial r l >actual && grep -E "\|+" actual && @@ -77,7 +77,7 @@ test_expect_success 'notes' ' git notes add -f -m l initial && test_must_fail git notes merge r && - ! grep -E "\|+" .git/NOTES_MERGE_WORKTREE/* && + grep -E "\|+" .git/NOTES_MERGE_WORKTREE/* && git notes merge --abort && test_must_fail git -c merge.conflictstyle=diff3 notes merge r && @@ -104,7 +104,7 @@ test_expect_success 'checkout' ' fill b d >content && git checkout --merge master && - ! grep -E "\|+" content && + grep -E "\|+" content && git config merge.conflictstyle merge && diff --git a/t/t7201-co.sh b/t/t7201-co.sh index 7f6e23a4bb..11444d5360 100755 --- a/t/t7201-co.sh +++ b/t/t7201-co.sh @@ -25,6 +25,8 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . ./test-lib.sh +git config merge.conflictstyle merge # TODO: use the default + test_tick fill () { diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh index 3fcb44767f..90449e80c3 100755 --- a/t/t7506-status-submodule.sh +++ b/t/t7506-status-submodule.sh @@ -253,6 +253,7 @@ test_expect_success 'status with merge conflict in .gitmodules' ' test_create_repo_with_commit sub2 && ( cd super && + git config merge.conflictstyle merge && # TODO: use the default prev=$(git rev-parse HEAD) && git checkout -b add_sub1 && git submodule add ../sub1 && diff --git a/xdiff-interface.c b/xdiff-interface.c index 19a030fbe2..1447771724 100644 --- a/xdiff-interface.c +++ b/xdiff-interface.c @@ -299,7 +299,7 @@ int xdiff_compare_lines(const char *l1, long s1, return xdl_recmatch(l1, s1, l2, s2, flags); } -int git_xmerge_style = XDL_MERGE_STYLE_MERGE; +int git_xmerge_style = XDL_MERGE_STYLE_DIFF3; int git_xmerge_config(const char *var, const char *value, void *cb) {