From patchwork Wed Mar 17 21:27:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 12146999 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=-12.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 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 9C5B5C433E6 for ; Wed, 17 Mar 2021 21:28:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5715D64F2A for ; Wed, 17 Mar 2021 21:28:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231549AbhCQV2Z (ORCPT ); Wed, 17 Mar 2021 17:28:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231737AbhCQV2J (ORCPT ); Wed, 17 Mar 2021 17:28:09 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9474C06174A for ; Wed, 17 Mar 2021 14:28:08 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id t9so3297344wrn.11 for ; Wed, 17 Mar 2021 14:28:08 -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=skoEo4SWYtUg71kvRBx6/BANdZpAEw7WB2wFqMP+Wc4=; b=RcswWThEorqqZHi4opmg2JaqGqens24L1HZXgMZa7RwUQyoJCIoLbREo18Zb2jcnxm DWoEqXNWM1/CNhpeqH1lXm6kqcWcu4/iERJXR6mRjEejhLFBzvSln0J6z37j1ZVo9HtX bB3JwKyR28joyeWhJlc+uw15gwH59DdtIk1PKZgpf5Hq9npQ/vwDImno+TKX4LpCbMff iV2EMdjdOK+x3xIyIz2J1Ewj0EKKUNUMDeg2/0+xG8q78u7ox7WyCB3kxD0IduvQb5Zl LWeetQQOymRui/F1za2udgFLCRo9dal0yBJRb6lRqbzyzgLnf46DiYV6nBmB7m74p3L9 oA7Q== 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=skoEo4SWYtUg71kvRBx6/BANdZpAEw7WB2wFqMP+Wc4=; b=W0yo473oruMHUz8NsxtWTJQxKLZ+t+mJlGlw73kk7B5kHB5oiVERIwqpPa5sZzmx7I EzxDd5lgIcO0Jf5q8FQrwYQ81sZOrC+ZObD3lwxT285FWh04BSJjM3WqiA/r/PW8nXa1 6sOhM96rR+Io7evXbJ9TDjLqHw18Pi7M1mijSSPkN7ImZdUD1MrIWNFAu5HUpWAT5yQH vOSsNqqewL1ly0szvGN7LyMfnqwWrIZrv0xQMh8DgiqSjWZXJNyGEBhuXCgl/SVXFyO4 R2Mqgmux7r5hhwCFdCigQgqOLiiJt4vVeRZlczWtRc4np4seAMDB4hkEMlizrogi+2a5 Jn1w== X-Gm-Message-State: AOAM532xxlf3sTmhqawOjGVIp52GZLow50QGQct0BDLwxeSdLSo8NH9H XuSzwE0RSOV6geYR2ACJ5ACxusSiCnE= X-Google-Smtp-Source: ABdhPJwTHRvYIb8i0T1zoAylpYMIsLafaRM6cx6PdFYWUHweqDsQGupHlM2X/u/7R5Q9X61B2oGvyA== X-Received: by 2002:a5d:4f0e:: with SMTP id c14mr6206844wru.78.1616016487653; Wed, 17 Mar 2021 14:28:07 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id o11sm201171wrq.74.2021.03.17.14.28.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 14:28:07 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Wed, 17 Mar 2021 21:27:53 +0000 Subject: [PATCH v2 01/13] merge-ort: use STABLE_QSORT instead of QSORT where required Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7A=?= Bjarmason , Taylor Blau , Jonathan Tan , Jeff King , Jonathan Nieder , Johannes Schindelin , Junio C Hamano , Derrick Stolee , Elijah Newren , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren rename/rename conflict handling depends on the fact that if both sides renamed the same path, that the one on the MERGE_SIDE1 will appear first in the combined diff_queue_struct passed to process_renames(). Since we add all pairs from MERGE_SIDE1 to combined first, and then all pairs from MERGE_SIDE2, and then sort based on filename, this will only be true if the sort used is stable. This was found due to the fact that Mac, unlike Linux, apparently has a system-defined qsort that is not stable. While we are at it, review the other callers of QSORT and add comments about why they can remain as calls to QSORT instead of being modified to call STABLE_QSORT. Signed-off-by: Elijah Newren --- merge-ort.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/merge-ort.c b/merge-ort.c index 7f5750ce6ab0..34a91c435737 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -2405,7 +2405,7 @@ static int detect_and_process_renames(struct merge_options *opt, clean &= collect_renames(opt, &combined, MERGE_SIDE2, &renames->dir_renames[1], &renames->dir_renames[2]); - QSORT(combined.queue, combined.nr, compare_pairs); + STABLE_QSORT(combined.queue, combined.nr, compare_pairs); trace2_region_leave("merge", "directory renames", opt->repo); trace2_region_enter("merge", "process renames", opt->repo); @@ -2550,6 +2550,7 @@ static void write_tree(struct object_id *result_oid, */ relevant_entries.items = versions->items + offset; relevant_entries.nr = versions->nr - offset; + /* No need for STABLE_QSORT -- filenames must be unique */ QSORT(relevant_entries.items, relevant_entries.nr, tree_entry_order); /* Pre-allocate some space in buf */ @@ -3325,6 +3326,11 @@ static int record_conflicted_index_entries(struct merge_options *opt, * entries we added to the end into their right locations. */ remove_marked_cache_entries(index, 1); + /* + * No need for STABLE_QSORT -- cmp_cache_name_compare sorts primarily + * on filename and secondarily on stage, and (name, stage #) are a + * unique tuple. + */ QSORT(index->cache, index->cache_nr, cmp_cache_name_compare); return errs; From patchwork Wed Mar 17 21:27:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 12146995 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=-12.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 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 EE208C433DB for ; Wed, 17 Mar 2021 21:28:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 89CBE64F04 for ; Wed, 17 Mar 2021 21:28:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231431AbhCQV2Y (ORCPT ); Wed, 17 Mar 2021 17:28:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231942AbhCQV2J (ORCPT ); Wed, 17 Mar 2021 17:28:09 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F460C06174A for ; Wed, 17 Mar 2021 14:28:09 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id e18so3315227wrt.6 for ; Wed, 17 Mar 2021 14:28:09 -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=i7t+eJQcgwTX2+yM47HxJduHsS0+Js64QpdHJo4KdIQ=; b=n6U1j726EJyICqPbUhs4W6qU6eR/0TtX87BSdeOftT3X8+pMz8WEHGKnFevJGiOUZZ IhmwwZFIxr2lNyJ8ncWPO43GIolosLqAsVBErqSLHE6mvu0GMkcLlsWPg3q6+NX+/DK0 EZqXZwf7mk+tHMhGr0yuQGEb7yI9Mo1daH3AwyTVyKI8e5sd9/FmZDF9oPRFaQojIFtF vraf7fk23bpa7+rEt8KSBxWmvtvlGx6PNOY3s6vZg97Y/5oX6bb9z8Gtn7OsU1Tku/DE 86pPX/2vuCS8+u3NI2PLrCpMoFUgntp16s3bYXsKKgJ8SY5I2X06I2mlEcDV1JImaash zjqQ== 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=i7t+eJQcgwTX2+yM47HxJduHsS0+Js64QpdHJo4KdIQ=; b=b7sA9QoBdvY20u4NeccQPNAyEV7FDPInTx5056FZ9EpxXtu9tAjld1UyLR0xdYpudc gvDXoQw6flBvb4UV8VSOqjGJ1t5y2UhHZQ0EyfAL64c+NzJG9X9XoMMShyVakIzEJnrH vOEk06MqXlGOX5uXzR2GUyO/dLsLw77ekvL686Ali5NYYcTwxQyYAzwu5OikBL7ASTDv SSDY8XybPCOQUwIk0698M41/cyCkrK7Yb1CAgfp5yAM4GuIHPtaJIpd/6L2Smov6W3Ma 9iRlLmcJt/fw6cZMWTLtL0xSOQI6R5Dxpbupw/qX8Ru+ZvqLuvrLCce4WcT8lbagYCSJ EnQw== X-Gm-Message-State: AOAM532SZgcOO/g6iSZwYVoJxvS57UzMHV9gmW+MX0kDpfOYLATTRbeJ LWrosUTO9dTE+i6d8WHyovcd03u4IIU= X-Google-Smtp-Source: ABdhPJwd16UjFjq1hGdRxBrw99K7jw8KvGLaDnMHpxVX6FUUGfvp9l4WPCEO4VLQOkSGMzrQBp2Ddw== X-Received: by 2002:a05:6000:1107:: with SMTP id z7mr6130040wrw.415.1616016488162; Wed, 17 Mar 2021 14:28:08 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id u2sm173372wmm.5.2021.03.17.14.28.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 14:28:07 -0700 (PDT) Message-Id: <6d34cc466bd53e074c690b58ef03391eac10e5d9.1616016485.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 17 Mar 2021 21:27:54 +0000 Subject: [PATCH v2 02/13] merge-ort: add a special minimal index just for renormalization Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7A=?= Bjarmason , Taylor Blau , Jonathan Tan , Jeff King , Jonathan Nieder , Johannes Schindelin , Junio C Hamano , Derrick Stolee , Elijah Newren , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren renormalize_buffer() requires an index_state, which is something that merge-ort does not operate with. However, all the renormalization code needs is an index with a .gitattributes file...plus a little bit of setup. Create such an index, along with the deallocation and attr_direction handling. A subsequent commit will add a function to finish the initialization of this index. Signed-off-by: Elijah Newren --- merge-ort.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/merge-ort.c b/merge-ort.c index 34a91c435737..3c606fa7e4b3 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -18,6 +18,7 @@ #include "merge-ort.h" #include "alloc.h" +#include "attr.h" #include "blob.h" #include "cache-tree.h" #include "commit.h" @@ -220,6 +221,16 @@ struct merge_options_internal { */ struct rename_info renames; + /* + * attr_index: hacky minimal index used for renormalization + * + * renormalization code _requires_ an index, though it only needs to + * find a .gitattributes file within the index. So, when + * renormalization is important, we create a special index with just + * that one file. + */ + struct index_state attr_index; + /* * current_dir_name, toplevel_dir: temporary vars * @@ -399,6 +410,9 @@ static void clear_or_reinit_internal_opts(struct merge_options_internal *opti, string_list_clear(&opti->paths_to_free, 0); opti->paths_to_free.strdup_strings = 0; + if (opti->attr_index.cache_nr) + discard_index(&opti->attr_index); + /* Free memory used by various renames maps */ for (i = MERGE_SIDE1; i <= MERGE_SIDE2; ++i) { strintmap_func(&renames->dirs_removed[i]); @@ -3407,6 +3421,8 @@ void merge_finalize(struct merge_options *opt, { struct merge_options_internal *opti = result->priv; + if (opt->renormalize) + git_attr_set_direction(GIT_ATTR_CHECKIN); assert(opt->priv == NULL); clear_or_reinit_internal_opts(opti, 0); @@ -3482,6 +3498,10 @@ static void merge_start(struct merge_options *opt, struct merge_result *result) /* Default to histogram diff. Actually, just hardcode it...for now. */ opt->xdl_opts = DIFF_WITH_ALG(opt, HISTOGRAM_DIFF); + /* Handle attr direction stuff for renormalization */ + if (opt->renormalize) + git_attr_set_direction(GIT_ATTR_CHECKOUT); + /* Initialization of opt->priv, our internal merge data */ trace2_region_enter("merge", "allocate/init", opt->repo); if (opt->priv) { From patchwork Wed Mar 17 21:27:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 12147001 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=-12.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 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 1A720C43381 for ; Wed, 17 Mar 2021 21:28:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C3D6764F2A for ; Wed, 17 Mar 2021 21:28:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233557AbhCQV2a (ORCPT ); Wed, 17 Mar 2021 17:28:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232714AbhCQV2K (ORCPT ); Wed, 17 Mar 2021 17:28:10 -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 D8DD1C06174A for ; Wed, 17 Mar 2021 14:28:09 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id u5-20020a7bcb050000b029010e9316b9d5so2134728wmj.2 for ; Wed, 17 Mar 2021 14:28:09 -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=cnf/QEJ8oejThB9c252suJGw0HPP+Uh2G/Edw1V71cM=; b=IUj9oilleaGCKClo9Pic7uBKHXoZVQ2AZ7dj520Iw/aUf4C8n2qve+NVtvsid9cjp8 s7ncL2savVBQsw9VKq0+X9WkefxafdExhR81sxqcIKk3xOHBuwKTfdv+0ksESXieD/xM FCYhy3KLs2kXrDN4kZfAdlrHDXmsfXQgClXRXD4+p/8KjauutrYl3zyJjatI0F9IEjr6 9YSUO8fnZYSAGZ15qmm1+oek/EajpmyyN2lWTGwaAbb5x0YuvoxoB9HLduDNkp8yJdwK JpZtkzGKH6ELk5+UUaU6ydwC/VHck7z71l3akKyOJQVZ+NjKKyHQ9gUHxWKZPBYN/fYU cOKA== 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=cnf/QEJ8oejThB9c252suJGw0HPP+Uh2G/Edw1V71cM=; b=q3A7HHk6kR8lFItGdmRHc4D6VU0aoGcjA7G9a3AGaj15PsFYir3d3Yi0bQg+8XsenD Mnz6dwVTb6GNz0ljnxnpGUgoPBipEyBSW63B75I6GpZR3bACUAZJWrTBQDz5dN3kvOeJ Aw6cVUbkjD6SuudbhTHGFhtlTj64HFmutigxCteByCTcO+dffbf15VZbeV2ItvNcSXI2 A1BTHfGQXrrZf8Vs+cqqQMchlDxhz4Fk++RyY+sC00mJs06c4zsirsftAqSNYgcB9lo1 J6OgN2lXDxC2eFByZnB6ya/cmGmVYoYlA400f6WPWjcx8tLnUHnA+3EnKPoe6JS6f0ze BAGA== X-Gm-Message-State: AOAM530eNH0N3fSao5yW0V8fcZuDi4WfwMk+LR7/ix9z7vrUcVebevaC F0A0foDaYXVpB7nBUefueudF0TCQCUo= X-Google-Smtp-Source: ABdhPJxm8a9sQ+/XmqDi/6lzgUvkCq/0b0mitggmRn/QaivWNdpbBJxdc5/Rb8od9J5zxsIG1MEiPg== X-Received: by 2002:a1c:318b:: with SMTP id x133mr674150wmx.154.1616016488685; Wed, 17 Mar 2021 14:28:08 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id i3sm218989wra.66.2021.03.17.14.28.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 14:28:08 -0700 (PDT) Message-Id: <4ff23d2f52a0abd41d81076f9dfa3a93319deca5.1616016485.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 17 Mar 2021 21:27:55 +0000 Subject: [PATCH v2 03/13] merge-ort: have ll_merge() use a special attr_index for renormalization Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7A=?= Bjarmason , Taylor Blau , Jonathan Tan , Jeff King , Jonathan Nieder , Johannes Schindelin , Junio C Hamano , Derrick Stolee , Elijah Newren , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren ll_merge() needs an index when renormalization is requested. Create one specifically for just this purpose with just the one needed entry. This fixes t6418.4 and t6418.5 under GIT_TEST_MERGE_ALGORITHM=ort. NOTE 1: Even if the user has a working copy or a real index (which is not a given as merge-ort can be used in bare repositories), we explicitly ignore any .gitattributes file from either of these locations. merge-ort can be used to merge two branches that are unrelated to HEAD, so .gitattributes from the working copy and current index should not be considered relevant. NOTE 2: Since we are in the middle of merging, there is a risk that .gitattributes itself is conflicted...leaving us with an ill-defined situation about how to perform the rest of the merge. It could be that the .gitattributes file does not even exist on one of the sides of the merge, or that it has been modified on both sides. If it's been modified on both sides, it's possible that it could itself be merged cleanly, though it's also possible that it only merges cleanly if you use the right version of the .gitattributes file to drive the merge. It gets kind of complicated. The only test we ever had that attempted to test behavior in this area was seemingly unaware of the undefined behavior, but knew the test wouldn't work for lack of attribute handling support, marked it as test_expect_failure from the beginning, but managed to fail for several reasons unrelated to attribute handling. See commit 6f6e7cfb52 ("t6038: remove problematic test", 2020-08-03) for details. So there are probably various ways to improve what initialize_attr_index() picks in the case of a conflicted .gitattributes but for now I just implemented something simple -- look for whatever .gitattributes file we can find in any of the higher order stages and use it. Signed-off-by: Elijah Newren --- merge-ort.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/merge-ort.c b/merge-ort.c index 3c606fa7e4b3..cdc1e2fe7a24 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -410,7 +410,7 @@ static void clear_or_reinit_internal_opts(struct merge_options_internal *opti, string_list_clear(&opti->paths_to_free, 0); opti->paths_to_free.strdup_strings = 0; - if (opti->attr_index.cache_nr) + if (opti->attr_index.cache_nr) /* true iff opt->renormalize */ discard_index(&opti->attr_index); /* Free memory used by various renames maps */ @@ -1201,6 +1201,63 @@ static int merge_submodule(struct merge_options *opt, return 0; } +static void initialize_attr_index(struct merge_options *opt) +{ + /* + * The renormalize_buffer() functions require attributes, and + * annoyingly those can only be read from the working tree or from + * an index_state. merge-ort doesn't have an index_state, so we + * generate a fake one containing only attribute information. + */ + struct merged_info *mi; + struct index_state *attr_index = &opt->priv->attr_index; + struct cache_entry *ce; + + attr_index->initialized = 1; + + if (!opt->renormalize) + return; + + mi = strmap_get(&opt->priv->paths, GITATTRIBUTES_FILE); + if (!mi) + return; + + if (mi->clean) { + int len = strlen(GITATTRIBUTES_FILE); + ce = make_empty_cache_entry(attr_index, len); + ce->ce_mode = create_ce_mode(mi->result.mode); + ce->ce_flags = create_ce_flags(0); + ce->ce_namelen = len; + oidcpy(&ce->oid, &mi->result.oid); + memcpy(ce->name, GITATTRIBUTES_FILE, len); + add_index_entry(attr_index, ce, + ADD_CACHE_OK_TO_ADD | ADD_CACHE_OK_TO_REPLACE); + get_stream_filter(attr_index, GITATTRIBUTES_FILE, &ce->oid); + } else { + int stage, len; + struct conflict_info *ci; + + ASSIGN_AND_VERIFY_CI(ci, mi); + for (stage = 0; stage < 3; stage++) { + unsigned stage_mask = (1 << stage); + + if (!(ci->filemask & stage_mask)) + continue; + len = strlen(GITATTRIBUTES_FILE); + ce = make_empty_cache_entry(attr_index, len); + ce->ce_mode = create_ce_mode(ci->stages[stage].mode); + ce->ce_flags = create_ce_flags(stage); + ce->ce_namelen = len; + oidcpy(&ce->oid, &ci->stages[stage].oid); + memcpy(ce->name, GITATTRIBUTES_FILE, len); + add_index_entry(attr_index, ce, + ADD_CACHE_OK_TO_ADD | ADD_CACHE_OK_TO_REPLACE); + get_stream_filter(attr_index, GITATTRIBUTES_FILE, + &ce->oid); + } + } +} + static int merge_3way(struct merge_options *opt, const char *path, const struct object_id *o, @@ -1215,6 +1272,9 @@ static int merge_3way(struct merge_options *opt, char *base, *name1, *name2; int merge_status; + if (!opt->priv->attr_index.initialized) + initialize_attr_index(opt); + ll_opts.renormalize = opt->renormalize; ll_opts.extra_marker_size = extra_marker_size; ll_opts.xdl_opts = opt->xdl_opts; @@ -1253,7 +1313,7 @@ static int merge_3way(struct merge_options *opt, merge_status = ll_merge(result_buf, path, &orig, base, &src1, name1, &src2, name2, - opt->repo->index, &ll_opts); + &opt->priv->attr_index, &ll_opts); free(base); free(name1); From patchwork Wed Mar 17 21:27:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 12147011 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=-12.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 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 2A393C4332E for ; Wed, 17 Mar 2021 21:28:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E5AF064F2B for ; Wed, 17 Mar 2021 21:28:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233555AbhCQV23 (ORCPT ); Wed, 17 Mar 2021 17:28:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233488AbhCQV2L (ORCPT ); Wed, 17 Mar 2021 17:28:11 -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 6E3C4C06175F for ; Wed, 17 Mar 2021 14:28:10 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id j7so3321150wrd.1 for ; Wed, 17 Mar 2021 14:28:10 -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=k+yspLm/RWGBF4nOoRv16D5B6QfCBOFG70DbofWSpA0=; b=oi7GE5wjCSRIGMVwW2TcopKpVAal/O7UCXHAxNHeBtefwXTK3jr06UjtsxPF804Ffs lPKqRne3jKXSwXEGzeOpUT8bfxKFrpq1QwfEWgNj0O0TuQilXhZMamegW2jE2JTG7qKc iqsj2BBmD3ZeP4UGoNI12GKfeMj6M0Hmq1rz7Y6b6z3iArfVabu+cm53M5bsdDW67Olw b76PZL9aTBMv2P0RxLb+7NXlGd8qRgknJ7w4hpXvgLMAgpfRDxMDrX6pboP7upohX9PU bhnSzLosAhEIdWt4Wzbs0rZVqCj/cnOzNZla7UxhlierkCfQvG9cFVMOyYD7rUH3vFxH xLVQ== 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=k+yspLm/RWGBF4nOoRv16D5B6QfCBOFG70DbofWSpA0=; b=lUBtJmy8mZYqnyyOWJQbte3yII4AUw5IjU/w1vEkZcH9v6+nE9zBDDby8ljCkwJMr7 FGpwsNlzIbhFKDFeRlgGdDa27hDyQY788eCCzSkmzP6XW7SbYfuQ1Iao6tBLd0K6485f 8yDvTPFqwf12oFAojqgjBJYOSMy5vWP2HOIRjdRVUcHdlPBgeiOiqMj1IUqTbxS2mMq6 YeP2+wJ0baKFKGEtgt5pOnvrlkpsHpSRLuKGOHMIgW9hNAxg/m7iwrPCqA1MmqIFbacb FGrH3eSyKszdtIcpA7E55x0jEarIUXXgxpMUL1bdnBEATo40wPMpEO4jlK96k5cHo90X BVGw== X-Gm-Message-State: AOAM530OX6wdg9NLtsiEfSHdKZaWBhEDiaHvP0eVfLtxKsj9PT0TQW2u RuUiGymYi380K00CV4Cx8MYyL7Nciy0= X-Google-Smtp-Source: ABdhPJxDiIUzjYOAZ6s3W6GQoO62DAC5ItM0aG+OEoowiXQYUZIoyC34ngQLuurt3pXoH7EQIb+nCg== X-Received: by 2002:a5d:4dd2:: with SMTP id f18mr6296943wru.366.1616016489225; Wed, 17 Mar 2021 14:28:09 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id v9sm185837wrn.86.2021.03.17.14.28.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 14:28:08 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Wed, 17 Mar 2021 21:27:56 +0000 Subject: [PATCH v2 04/13] merge-ort: let renormalization change modify/delete into clean delete Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7A=?= Bjarmason , Taylor Blau , Jonathan Tan , Jeff King , Jonathan Nieder , Johannes Schindelin , Junio C Hamano , Derrick Stolee , Elijah Newren , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren When we have a modify/delete conflict, but the only change to the modification is e.g. change of line endings, then if renormalization is requested then we should be able to recognize such a case as a not-modified/delete and resolve the conflict automatically. This fixes t6418.10 under GIT_TEST_MERGE_ALGORITHM=ort. Signed-off-by: Elijah Newren --- merge-ort.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/merge-ort.c b/merge-ort.c index cdc1e2fe7a24..c7083e3769aa 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -2549,6 +2549,61 @@ static int string_list_df_name_compare(const char *one, const char *two) return onelen - twolen; } +static int read_oid_strbuf(struct merge_options *opt, + const struct object_id *oid, + struct strbuf *dst) +{ + void *buf; + enum object_type type; + unsigned long size; + buf = read_object_file(oid, &type, &size); + if (!buf) + return err(opt, _("cannot read object %s"), oid_to_hex(oid)); + if (type != OBJ_BLOB) { + free(buf); + return err(opt, _("object %s is not a blob"), oid_to_hex(oid)); + } + strbuf_attach(dst, buf, size, size + 1); + return 0; +} + +static int blob_unchanged(struct merge_options *opt, + const struct version_info *base, + const struct version_info *side, + const char *path) +{ + struct strbuf basebuf = STRBUF_INIT; + struct strbuf sidebuf = STRBUF_INIT; + int ret = 0; /* assume changed for safety */ + const struct index_state *idx = &opt->priv->attr_index; + + if (!idx->initialized) + initialize_attr_index(opt); + + if (base->mode != side->mode) + return 0; + if (oideq(&base->oid, &side->oid)) + return 1; + + if (read_oid_strbuf(opt, &base->oid, &basebuf) || + read_oid_strbuf(opt, &side->oid, &sidebuf)) + goto error_return; + /* + * Note: binary | is used so that both renormalizations are + * performed. Comparison can be skipped if both files are + * unchanged since their sha1s have already been compared. + */ + if (renormalize_buffer(idx, path, basebuf.buf, basebuf.len, &basebuf) | + renormalize_buffer(idx, path, sidebuf.buf, sidebuf.len, &sidebuf)) + ret = (basebuf.len == sidebuf.len && + !memcmp(basebuf.buf, sidebuf.buf, basebuf.len)); + +error_return: + strbuf_release(&basebuf); + strbuf_release(&sidebuf); + return ret; +} + struct directory_versions { /* * versions: list of (basename -> version_info) @@ -3136,8 +3191,13 @@ static void process_entry(struct merge_options *opt, modify_branch = (side == 1) ? opt->branch1 : opt->branch2; delete_branch = (side == 1) ? opt->branch2 : opt->branch1; - if (ci->path_conflict && - oideq(&ci->stages[0].oid, &ci->stages[side].oid)) { + if (opt->renormalize && + blob_unchanged(opt, &ci->stages[0], &ci->stages[side], + path)) { + ci->merged.is_null = 1; + ci->merged.clean = 1; + } else if (ci->path_conflict && + oideq(&ci->stages[0].oid, &ci->stages[side].oid)) { /* * This came from a rename/delete; no action to take, * but avoid printing "modify/delete" conflict notice From patchwork Wed Mar 17 21:27:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 12146997 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=-12.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 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 E9F02C4332B for ; Wed, 17 Mar 2021 21:28:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A4A3664F38 for ; Wed, 17 Mar 2021 21:28:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231942AbhCQV20 (ORCPT ); Wed, 17 Mar 2021 17:28:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233494AbhCQV2L (ORCPT ); Wed, 17 Mar 2021 17:28:11 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07EF3C06174A for ; Wed, 17 Mar 2021 14:28:11 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id z2so3308374wrl.5 for ; Wed, 17 Mar 2021 14:28:10 -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=ftj6qMkNmrnsXmtUxcUDofo5ZMdWVt4dfoOIo49gQVo=; b=JihzdWqVjOgCgr3WM/X8ZsSOUu97jZcoqOXyqL7H9qvrmbBfNL4oiShyhkSuX+gbv3 XztiHUj7e4kLtYRVNsI2nmUq7jUz1HQKkUflUZfvBF/GNsXclsMo9HIMsiHH0otvWmbK 0CnymyLvfcNgCixEHYGWKLCDpx90GgbyVgNs6G7RBKuKaOPw6CXFCdgLaC18BJJVRXX5 nYLNzQ7RlxEQE6/76A5uK4nA66E/wWz7FGdv8mUwvyunJLOoRquf2irXuFIkUqber5kH m2qzQSMOBDqqdQqN1Tda6rfNxBcl4Sg0RI1bqI/Td/pIRM1f3oPZrwukfuZ/0O0cktGv jJtg== 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=ftj6qMkNmrnsXmtUxcUDofo5ZMdWVt4dfoOIo49gQVo=; b=mIf2xe9FK2CEf3od/LuY5rcmWX0hYfbpG9JgBvgQc0WmHJxkbuVgLyzsbASK1HeGlS Z7zfJNYc7R1a14ny7cFb/kl2xMDY+NBj11s1fpxRcptqDFvk/MJ8dtS3RoO+hIMjoZ0t BRZ6cU2mxqkj5kgHvEXF+bO8tabrYD5cTBvg5G+KyjNZdbagPSrJDPvQwXWMiyucWaaK g211XZQX8ZS+weNDHU7g5dcCt8se5djC6mHVa771WZf2OzvY7kCLgh6LOWKzk2k03OG1 rIaZ1pj72kNRe0gaGJEbNi5EYS7UEqaWse45/X5soAJ6bdxhGDBsJ8657dnw2whtmYF4 oViA== X-Gm-Message-State: AOAM533QDQxBs5WpKZGRXecG/QroxmstY3lmWtWZYI4myX8bcJhWDQaA i6gXqZnUMUuJWeWj35qXJ8ryXx+ELf0= X-Google-Smtp-Source: ABdhPJxh0GgPz7AI7ZUqjNDuC6a2q04G97ZAZEpGmMjGMmS7KKPi8pCaKY266fIiZXBOkpFvw+6VDw== X-Received: by 2002:adf:fec5:: with SMTP id q5mr6112172wrs.43.1616016489762; Wed, 17 Mar 2021 14:28:09 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id x8sm218169wru.46.2021.03.17.14.28.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 14:28:09 -0700 (PDT) Message-Id: <41fffcdd3b786c460c3a0652108212d8c361159f.1616016485.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 17 Mar 2021 21:27:57 +0000 Subject: [PATCH v2 05/13] merge-ort: support subtree shifting Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7A=?= Bjarmason , Taylor Blau , Jonathan Tan , Jeff King , Jonathan Nieder , Johannes Schindelin , Junio C Hamano , Derrick Stolee , Elijah Newren , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren merge-recursive has some simple code to support subtree shifting; copy it over to merge-ort. This fixes t6409.12 under GIT_TEST_MERGE_ALGORITHM=ort. Signed-off-by: Elijah Newren --- merge-ort.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/merge-ort.c b/merge-ort.c index c7083e3769aa..c4fe234d8972 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -3551,6 +3551,23 @@ void merge_finalize(struct merge_options *opt, /*** Function Grouping: helper functions for merge_incore_*() ***/ +static struct tree *shift_tree_object(struct repository *repo, + struct tree *one, struct tree *two, + const char *subtree_shift) +{ + struct object_id shifted; + + if (!*subtree_shift) { + shift_tree(repo, &one->object.oid, &two->object.oid, &shifted, 0); + } else { + shift_tree_by(repo, &one->object.oid, &two->object.oid, &shifted, + subtree_shift); + } + if (oideq(&two->object.oid, &shifted)) + return two; + return lookup_tree(repo, &shifted); +} + static inline void set_commit_tree(struct commit *c, struct tree *t) { c->maybe_tree = t; @@ -3680,6 +3697,13 @@ static void merge_ort_nonrecursive_internal(struct merge_options *opt, { struct object_id working_tree_oid; + if (opt->subtree_shift) { + side2 = shift_tree_object(opt->repo, side1, side2, + opt->subtree_shift); + merge_base = shift_tree_object(opt->repo, side1, merge_base, + opt->subtree_shift); + } + trace2_region_enter("merge", "collect_merge_info", opt->repo); if (collect_merge_info(opt, merge_base, side1, side2) != 0) { /* From patchwork Wed Mar 17 21:27:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 12147009 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=-12.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 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 42C55C4332D for ; Wed, 17 Mar 2021 21:28:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1978764F3B for ; Wed, 17 Mar 2021 21:28:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233561AbhCQV2b (ORCPT ); Wed, 17 Mar 2021 17:28:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233508AbhCQV2L (ORCPT ); Wed, 17 Mar 2021 17:28:11 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FBABC06174A for ; Wed, 17 Mar 2021 14:28:11 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id z2so3308393wrl.5 for ; Wed, 17 Mar 2021 14:28:11 -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=XXkada0tjiFQqfS5wUUxv6rDq4t4jraSD+9f2/tJEHk=; b=oaf8fR86eWzgEkFRqQ5LoZ9n1F3z0VgxMGMvZJp2LW86C33/l1jtazG9cjZ1hrAnFR cTATqqjzUfzqHqLkNnxhllAIa80pw9kFotYNwXeqz77cY9ii6g089G8r0JbmDG+1I9Rg ZKrkIZEUEIGQkzuNx0Qvs/w2VEprBmYQXgu7avxmcUm5r5dyGDbCSKneOwYGnn3P+BrA /qWFvKtLnmSXSlu2Kpnl62UF1YFuAN7JwZYxO5Rhv4Q6lWY6N54FFJ/7QYhEQ2T9mbmL aFgPlThFl4oBbeurzgMa4U/3r3OzI5PJNs1rlQPHiNWDkwrptaXQqsDuNoaSz/66WzYe J5Ug== 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=XXkada0tjiFQqfS5wUUxv6rDq4t4jraSD+9f2/tJEHk=; b=owcTRvqgGeMmFjVBX2lWSl52IIExBbE3ih9is0sfVzhmjwkJWu8J7AVoIEovXhqWDR L5xK75c6DxksqTFDxqzu00D1hhi26ZVCnhBlfWHrYMK+IsbTo42tBbLS/qwTdimrjR5U ckTjQep29yl99K+ONPNwFdHqVbavVY70e0qT4fB5ceyM/CK2eUK/BcEEXWC0FM8jcsEe gp1h/Dp9AtZu/x09xYw0mpI0Xz6LBmWO2J7lPS84e+9xifjuGbBzfrD654dvyfEKXhIz FL1OgiN1jDZnT2V061P0cl5qdbTs2t5zOW7Gijpix9UVPxRMuMhtyrfgbVtZLdU7mu+Q aZGA== X-Gm-Message-State: AOAM533f623dqUn7QPohfcRzmUDWTn+RX8+n6vg40cbKiswFk4LNHDEV EvTDycvxVUZqUVM/1GoFEh3AQ0pVz30= X-Google-Smtp-Source: ABdhPJwDUPhvSlCcTwnrGgNIUcQShzi+54R14946oxojkXhKvANE0Tod2upFg4V10R6MUZzDY8/yjg== X-Received: by 2002:adf:ff8c:: with SMTP id j12mr6261605wrr.297.1616016490289; Wed, 17 Mar 2021 14:28:10 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id m17sm184629wrx.92.2021.03.17.14.28.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 14:28:10 -0700 (PDT) Message-Id: <6aec1f499b8068329b81fb1221717c2ee336fd8d.1616016485.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 17 Mar 2021 21:27:58 +0000 Subject: [PATCH v2 06/13] t6428: new test for SKIP_WORKTREE handling and conflicts Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7A=?= Bjarmason , Taylor Blau , Jonathan Tan , Jeff King , Jonathan Nieder , Johannes Schindelin , Junio C Hamano , Derrick Stolee , Elijah Newren , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren If there is a conflict during a merge for a SKIP_WORKTREE entry, we expect that file to be written to the working copy and have the SKIP_WORKTREE bit cleared in the index. If the user had manually created a file in the working tree despite SKIP_WORKTREE being set, we do not want to clobber their changes to that file, but want to move it out of the way. Add tests that check for these behaviors. Signed-off-by: Elijah Newren --- t/t6428-merge-conflicts-sparse.sh | 158 ++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100755 t/t6428-merge-conflicts-sparse.sh diff --git a/t/t6428-merge-conflicts-sparse.sh b/t/t6428-merge-conflicts-sparse.sh new file mode 100755 index 000000000000..1bb52ff6f38c --- /dev/null +++ b/t/t6428-merge-conflicts-sparse.sh @@ -0,0 +1,158 @@ +#!/bin/sh + +test_description="merge cases" + +# The setup for all of them, pictorially, is: +# +# A +# o +# / \ +# O o ? +# \ / +# o +# B +# +# To help make it easier to follow the flow of tests, they have been +# divided into sections and each test will start with a quick explanation +# of what commits O, A, and B contain. +# +# Notation: +# z/{b,c} means files z/b and z/c both exist +# x/d_1 means file x/d exists with content d1. (Purpose of the +# underscore notation is to differentiate different +# files that might be renamed into each other's paths.) + +. ./test-lib.sh +. "$TEST_DIRECTORY"/lib-merge.sh + + +# Testcase basic, conflicting changes in 'numerals' + +test_setup_numerals () { + test_create_repo numerals_$1 && + ( + cd numerals_$1 && + + >README && + test_write_lines I II III >numerals && + git add README numerals && + test_tick && + git commit -m "O" && + + git branch O && + git branch A && + git branch B && + + git checkout A && + test_write_lines I II III IIII >numerals && + git add numerals && + test_tick && + git commit -m "A" && + + git checkout B && + test_write_lines I II III IV >numerals && + git add numerals && + test_tick && + git commit -m "B" && + + cat <<-EOF >expected-index && + H README + M numerals + M numerals + M numerals + EOF + + cat <<-EOF >expected-merge + I + II + III + <<<<<<< HEAD + IIII + ======= + IV + >>>>>>> B^0 + EOF + + ) +} + +test_expect_merge_algorithm success failure 'conflicting entries written to worktree even if sparse' ' + test_setup_numerals plain && + ( + cd numerals_plain && + + git checkout A^0 && + + test_path_is_file README && + test_path_is_file numerals && + + git sparse-checkout init && + git sparse-checkout set README && + + test_path_is_file README && + test_path_is_missing numerals && + + test_must_fail git merge -s recursive B^0 && + + git ls-files -t >index_files && + test_cmp expected-index index_files && + + test_path_is_file README && + test_path_is_file numerals && + + test_cmp expected-merge numerals && + + # 4 other files: + # * expected-merge + # * expected-index + # * index_files + # * others + git ls-files -o >others && + test_line_count = 4 others + ) +' + +test_expect_merge_algorithm failure failure 'present-despite-SKIP_WORKTREE handled reasonably' ' + test_setup_numerals in_the_way && + ( + cd numerals_in_the_way && + + git checkout A^0 && + + test_path_is_file README && + test_path_is_file numerals && + + git sparse-checkout init && + git sparse-checkout set README && + + test_path_is_file README && + test_path_is_missing numerals && + + echo foobar >numerals && + + test_must_fail git merge -s recursive B^0 && + + git ls-files -t >index_files && + test_cmp expected-index index_files && + + test_path_is_file README && + test_path_is_file numerals && + + test_cmp expected-merge numerals && + + # There should still be a file with "foobar" in it + grep foobar * && + + # 5 other files: + # * expected-merge + # * expected-index + # * index_files + # * others + # * whatever name was given to the numerals file that had + # "foobar" in it + git ls-files -o >others && + test_line_count = 5 others + ) +' + +test_done From patchwork Wed Mar 17 21:27:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 12147005 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=-12.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 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 66FEDC43331 for ; Wed, 17 Mar 2021 21:28:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3E4BB64F2A for ; Wed, 17 Mar 2021 21:28:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233559AbhCQV2b (ORCPT ); Wed, 17 Mar 2021 17:28:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233513AbhCQV2M (ORCPT ); Wed, 17 Mar 2021 17:28:12 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29D24C06174A for ; Wed, 17 Mar 2021 14:28:12 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id x16so3313030wrn.4 for ; Wed, 17 Mar 2021 14:28:12 -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=eGphsfSLxSih+gC6ig10Nu03y71Itud2yHKKHLi8FMQ=; b=ExOeyMe0nkU6fkjB5QQXXjF64xkNi5TNDnl5iiXtuIICKXogu22ij8GI2X65/zXBja u0UZZ4PnkE1D6dN7AOU71FXFxm7SzX6zbO6l9vch4BSq7oaz3lVVWCQ5QZDpbsOKfEop bEVQ6UmRqIyaxDaMu2e+jPQWLO8hXnCnjQhIr9dxF+RzKYtX/tNjo3XgEMUd6oOG1k76 gql2V04mMHdOaZf9OPDpL/W6ikEprpSQXkYNEWYg9iUrCjOjfVqMsH4pgp6mByZe4hR5 7HKTflziHvJ6tAwWE0xKX0q/jfPaoa/Zkq2iYQLNfzT0vASOuGpqkOig+jnzL9S9mG4c EwUg== 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=eGphsfSLxSih+gC6ig10Nu03y71Itud2yHKKHLi8FMQ=; b=SiIhYTp2VDcDlQDjfNfIdoH+wCM9mF2uZyrOSZ1WnaDj+/oxlMH9f4XmlqfqhAYzF+ oFlYU8C0vjvUxJP4besXmIgDR8YHXiiQCvPFbF95/4MVMiRzalDEmGFrjkKUDEcK1Rgn hy+AMb3crPuMuQ0/e2Iccn2WHx7p6q/TFzOB8fGZqV6ISbY3vwXnzSNPm7IMa+xbKX89 AlXGJpL/1py9IOaLexR1+3p2JGmBnpo093DanCdrEDpemcSbF6uVivt3jE6yaNBf0EvR DeUF5x0OMufoWposzxVGv4ybQV3IRrAKT8ciIwR4i6xwY41xm6DF1WQHs6nktl8jgL3s XBBA== X-Gm-Message-State: AOAM533ZMex7VuN+UZJSqG5GS7l/pGJrmmxRRQlfQ4GZTDWF85lwmw6S LCVZ4n/CvQhNufqkvcS9t/YPhYy40YI= X-Google-Smtp-Source: ABdhPJxw5LobavjyBSY7SamgQ2srGUoRGHEBtz4vHF1Cjfc6yDUsdSL60zNMFJACW/We/o4GogZsMg== X-Received: by 2002:a05:6000:1acd:: with SMTP id i13mr4492673wry.48.1616016490932; Wed, 17 Mar 2021 14:28:10 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id u20sm262499wru.6.2021.03.17.14.28.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 14:28:10 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Wed, 17 Mar 2021 21:27:59 +0000 Subject: [PATCH v2 07/13] merge-ort: implement CE_SKIP_WORKTREE handling with conflicted entries Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7A=?= Bjarmason , Taylor Blau , Jonathan Tan , Jeff King , Jonathan Nieder , Johannes Schindelin , Junio C Hamano , Derrick Stolee , Elijah Newren , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren When merge conflicts occur in paths removed by a sparse-checkout, we need to unsparsify those paths (clear the SKIP_WORKTREE bit), and write out the conflicted file to the working copy. In the very unlikely case that someone manually put a file into the working copy at the location of the SKIP_WORKTREE file, we need to avoid overwriting whatever edits they have made and move that file to a different location first. Signed-off-by: Elijah Newren --- merge-ort.c | 43 +++++++++++++++++++++---------- t/t6428-merge-conflicts-sparse.sh | 4 +-- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/merge-ort.c b/merge-ort.c index c4fe234d8972..303e89414274 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -3369,23 +3369,27 @@ static int checkout(struct merge_options *opt, return ret; } -static int record_conflicted_index_entries(struct merge_options *opt, - struct index_state *index, - struct strmap *paths, - struct strmap *conflicted) +static int record_conflicted_index_entries(struct merge_options *opt) { struct hashmap_iter iter; struct strmap_entry *e; + struct index_state *index = opt->repo->index; + struct checkout state = CHECKOUT_INIT; int errs = 0; int original_cache_nr; - if (strmap_empty(conflicted)) + if (strmap_empty(&opt->priv->conflicted)) return 0; + /* If any entries have skip_worktree set, we'll have to check 'em out */ + state.force = 1; + state.quiet = 1; + state.refresh_cache = 1; + state.istate = index; original_cache_nr = index->cache_nr; /* Put every entry from paths into plist, then sort */ - strmap_for_each_entry(conflicted, &iter, e) { + strmap_for_each_entry(&opt->priv->conflicted, &iter, e) { const char *path = e->key; struct conflict_info *ci = e->value; int pos; @@ -3426,9 +3430,23 @@ static int record_conflicted_index_entries(struct merge_options *opt, * the higher order stages. Thus, we need override * the CE_SKIP_WORKTREE bit and manually write those * files to the working disk here. - * - * TODO: Implement this CE_SKIP_WORKTREE fixup. */ + if (ce_skip_worktree(ce)) { + struct stat st; + + if (!lstat(path, &st)) { + char *new_name = unique_path(&opt->priv->paths, + path, + "cruft"); + + path_msg(opt, path, 1, + _("Note: %s not up to date and in way of checking out conflicted version; old copy renamed to %s"), + path, new_name); + errs |= rename(path, new_name); + free(new_name); + } + errs |= checkout_entry(ce, &state, NULL, NULL); + } /* * Mark this cache entry for removal and instead add @@ -3478,8 +3496,6 @@ void merge_switch_to_result(struct merge_options *opt, { assert(opt->priv == NULL); if (result->clean >= 0 && update_worktree_and_index) { - struct merge_options_internal *opti = result->priv; - trace2_region_enter("merge", "checkout", opt->repo); if (checkout(opt, head, result->tree)) { /* failure to function */ @@ -3489,13 +3505,14 @@ void merge_switch_to_result(struct merge_options *opt, trace2_region_leave("merge", "checkout", opt->repo); trace2_region_enter("merge", "record_conflicted", opt->repo); - if (record_conflicted_index_entries(opt, opt->repo->index, - &opti->paths, - &opti->conflicted)) { + opt->priv = result->priv; + if (record_conflicted_index_entries(opt)) { /* failure to function */ + opt->priv = NULL; result->clean = -1; return; } + opt->priv = NULL; trace2_region_leave("merge", "record_conflicted", opt->repo); } diff --git a/t/t6428-merge-conflicts-sparse.sh b/t/t6428-merge-conflicts-sparse.sh index 1bb52ff6f38c..7e8bf497f821 100755 --- a/t/t6428-merge-conflicts-sparse.sh +++ b/t/t6428-merge-conflicts-sparse.sh @@ -76,7 +76,7 @@ test_setup_numerals () { ) } -test_expect_merge_algorithm success failure 'conflicting entries written to worktree even if sparse' ' +test_expect_success 'conflicting entries written to worktree even if sparse' ' test_setup_numerals plain && ( cd numerals_plain && @@ -112,7 +112,7 @@ test_expect_merge_algorithm success failure 'conflicting entries written to work ) ' -test_expect_merge_algorithm failure failure 'present-despite-SKIP_WORKTREE handled reasonably' ' +test_expect_merge_algorithm failure success 'present-despite-SKIP_WORKTREE handled reasonably' ' test_setup_numerals in_the_way && ( cd numerals_in_the_way && From patchwork Wed Mar 17 21:28:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 12147007 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=-12.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 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 884D4C43333 for ; Wed, 17 Mar 2021 21:28:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5DAC364F3B for ; Wed, 17 Mar 2021 21:28:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233565AbhCQV2c (ORCPT ); Wed, 17 Mar 2021 17:28:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233522AbhCQV2N (ORCPT ); Wed, 17 Mar 2021 17:28:13 -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 AE26CC06174A for ; Wed, 17 Mar 2021 14:28:12 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id x13so3313566wrs.9 for ; Wed, 17 Mar 2021 14:28:12 -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=RjXqIGfs6xg6JMfPfkR6AO1ReuEMf1tdF6If1ZnSgZM=; b=JNpgyx/CZnNacbV339hAA9CoP5XdVV7M/9AUDy0rLX/ndovrLnUFopa59gBat21ePV RMy2IqnrpFezupYk1g8rY8h7hl76ZH8G5z3Kal3vU3MmUK09o4xRCJyrPyoa2usk4iJr Aeba6+teyP0x7ULGLRGEX7li1DiksslzDmh5j9Y1T16xb+2CJ1PRexbw7UqLFCaZ3raY 6WVs/K1N+qlD9TWCUh+xBJw67HxD+D/mtj5bBgL1+MGXF0dbXCTf8fTVih5DNVmW5ygO jcV/eEAIj0IyY5mjLtbibl6qRUbl8LIdmbDkd4iSbLQFndaaE8iDeFi2Fz8cLF56uNVM 5Ygw== 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=RjXqIGfs6xg6JMfPfkR6AO1ReuEMf1tdF6If1ZnSgZM=; b=g/UPlX+R841M6BMEfmkWT+iuFkwKxGLHVo+RTAjb0HTw10TIpDWc2eWiJksEZrfuc2 yTY0vXj30pK3lQtfKkL+4scRcY9kFcfNgclFMZmJNuMU4wGHtAsFqEixmnY8HuMmTA3a ifgE4EpTu9BbbUa+tXu5hb9u0CCzCaCqR8MaX6j53CRWvkG2y/Zd06IEAIY/UPVScSSb oV/KBDAmZHyOmdyj6GQkSgI7CAfkhopZkWSyCbxcgQZ8Zr4TyKweAB9Jq8ub0VhgzBo4 bRiAsO8jTE5ZsJd4o7mJCMeZRVfpqUV2m1o1iBuXAwXxV3776LxbJ7UahGLG0rZdKLmD 8jwg== X-Gm-Message-State: AOAM532LGsr21BOmShLGKDSmvJ737ckevGTctEKGiQ2ss39NpxpJKZD8 c+4geEvhc56U+k0f6fWuOKOKaA+VT98= X-Google-Smtp-Source: ABdhPJwPKGSZyZRd9e4YAsBTBJ2Dsaz6qpiQy7rBZf4itCN10r+l8PzUMbcSA3C6NdGIhNHJ6XTl0g== X-Received: by 2002:adf:b313:: with SMTP id j19mr6189819wrd.188.1616016491548; Wed, 17 Mar 2021 14:28:11 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id h9sm110827wmb.35.2021.03.17.14.28.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 14:28:11 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Wed, 17 Mar 2021 21:28:00 +0000 Subject: [PATCH v2 08/13] t: mark several submodule merging tests as fixed under merge-ort Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7A=?= Bjarmason , Taylor Blau , Jonathan Tan , Jeff King , Jonathan Nieder , Johannes Schindelin , Junio C Hamano , Derrick Stolee , Elijah Newren , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren merge-ort handles submodules (and directory/file conflicts in general) differently than merge-recursive does; it basically puts all the special handling for different filetypes into one place in the codebase instead of needing special handling for different filetypes in many different code paths. This one code path in merge-ort could perhaps use some work still (there are still test_expect_failure cases in the testsuite), but it passes all the tests that merge-recursive does as well as 12 additional ones that merge-recursive fails. Mark those 12 tests as test_expect_success under merge-ort. Signed-off-by: Elijah Newren --- t/t3512-cherry-pick-submodule.sh | 7 +++++-- t/t3513-revert-submodule.sh | 5 ++++- t/t5572-pull-submodule.sh | 7 +++++-- t/t6437-submodule-merge.sh | 5 +++-- t/t6438-submodule-directory-file-conflicts.sh | 7 +++++-- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/t/t3512-cherry-pick-submodule.sh b/t/t3512-cherry-pick-submodule.sh index 822f2d4bfbd5..c657840db33b 100755 --- a/t/t3512-cherry-pick-submodule.sh +++ b/t/t3512-cherry-pick-submodule.sh @@ -8,8 +8,11 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . ./test-lib.sh . "$TEST_DIRECTORY"/lib-submodule-update.sh -KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1 -KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1 +if test "$GIT_TEST_MERGE_ALGORITHM" != ort +then + KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1 + KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1 +fi test_submodule_switch "cherry-pick" test_expect_success 'unrelated submodule/file conflict is ignored' ' diff --git a/t/t3513-revert-submodule.sh b/t/t3513-revert-submodule.sh index a759f12cbb1d..74cd96e58223 100755 --- a/t/t3513-revert-submodule.sh +++ b/t/t3513-revert-submodule.sh @@ -30,7 +30,10 @@ git_revert () { git revert HEAD } -KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1 +if test "$GIT_TEST_MERGE_ALGORITHM" != ort +then + KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1 +fi test_submodule_switch_func "git_revert" test_done diff --git a/t/t5572-pull-submodule.sh b/t/t5572-pull-submodule.sh index 29537f4798ef..4f92a116e1f0 100755 --- a/t/t5572-pull-submodule.sh +++ b/t/t5572-pull-submodule.sh @@ -42,8 +42,11 @@ git_pull_noff () { $2 git pull --no-ff } -KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1 -KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1 +if test "$GIT_TEST_MERGE_ALGORITHM" != ort +then + KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1 + KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1 +fi test_submodule_switch_func "git_pull_noff" test_expect_success 'pull --recurse-submodule setup' ' diff --git a/t/t6437-submodule-merge.sh b/t/t6437-submodule-merge.sh index 0f92bcf326c8..e5e89c2045e7 100755 --- a/t/t6437-submodule-merge.sh +++ b/t/t6437-submodule-merge.sh @@ -6,6 +6,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . ./test-lib.sh +. "$TEST_DIRECTORY"/lib-merge.sh # # history @@ -328,7 +329,7 @@ test_expect_success 'setup file/submodule conflict' ' ) ' -test_expect_failure 'file/submodule conflict' ' +test_expect_merge_algorithm failure success 'file/submodule conflict' ' test_when_finished "git -C file-submodule reset --hard" && ( cd file-submodule && @@ -437,7 +438,7 @@ test_expect_failure 'directory/submodule conflict; keep submodule clean' ' ) ' -test_expect_failure !FAIL_PREREQS 'directory/submodule conflict; should not treat submodule files as untracked or in the way' ' +test_expect_merge_algorithm failure success !FAIL_PREREQS 'directory/submodule conflict; should not treat submodule files as untracked or in the way' ' test_when_finished "git -C directory-submodule/path reset --hard" && test_when_finished "git -C directory-submodule reset --hard" && ( diff --git a/t/t6438-submodule-directory-file-conflicts.sh b/t/t6438-submodule-directory-file-conflicts.sh index 04bf4be7d792..8df67a0ef99d 100755 --- a/t/t6438-submodule-directory-file-conflicts.sh +++ b/t/t6438-submodule-directory-file-conflicts.sh @@ -12,8 +12,11 @@ test_submodule_switch "merge --ff" test_submodule_switch "merge --ff-only" -KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1 -KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1 +if test "$GIT_TEST_MERGE_ALGORITHM" != ort +then + KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1 + KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1 +fi test_submodule_switch "merge --no-ff" test_done From patchwork Wed Mar 17 21:28:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 12147015 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=-12.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 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 A864BC43332 for ; Wed, 17 Mar 2021 21:28:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 80C8064F2A for ; Wed, 17 Mar 2021 21:28:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233563AbhCQV2c (ORCPT ); Wed, 17 Mar 2021 17:28:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233535AbhCQV2N (ORCPT ); Wed, 17 Mar 2021 17:28:13 -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 3DBECC06174A for ; Wed, 17 Mar 2021 14:28:13 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id z2so3308472wrl.5 for ; Wed, 17 Mar 2021 14:28:13 -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=YnhiuQV/2Wc+3z93qURlauJEUrKVi/jU9n84Rplg354=; b=idINbWmy/vqaK2gzqcCZPoNf0zEchlmLVFq86fJpMQ4AaucN3K4Dbcq+F8tSohxFPv gIagFWGvB+ukh6bag6fk5spH5GzkxNl8+sGM+knD6Sql5LnknI4JsmmP9EIwh6+rF6AY BhbMjasmafuVGvnB/nxI8rfrqp27Bus4V4QUoRpQ5Ld6uzg4Xx7Sy1KtZL5FToObQDyF mc/WJAFoAxI2A4gx3DhYu3FKP3AtVXQEMIQK6HU5xJf0eqTO6aNvEi+xlb0aoCbdmhqJ cEhVJdfxzGrC1q2om4j4j+b+V50n/JaXFwhQRWr62Hk9yiNZE/5T1JMEM8ibAzKAjq1r PQhw== 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=YnhiuQV/2Wc+3z93qURlauJEUrKVi/jU9n84Rplg354=; b=DEn7g95QgZUb7s1mtlkuUlnKr9XnVcHTVjoLSHHAhZKwvcCppMnFfJe9e+MNlI5H2T ffbQAgZrwgTjyAeH2U9fWN3eSkt9c7A5BaM+xaJv+5g1en1RAnkJmgQesfsq8J9qQfMy p8G8sLB+Z1PSBYFZmdvdhGgJOFhkSfJYb4G7rVQc51OhoYJuGdr2H1txkua6DMnwlVaJ IXdYii39dmwIVCe/EZqoycfys4q0/GB1a+a1fQxFTjRaBUWfs2+jB8C1YtPIbSKxgh/C 2E6/pzZKNAYaM/j3tnoCsiTeMBTQjVqn9/JWWyxznRhntqesY61bM+p07BWWt2yRrWwq jRDg== X-Gm-Message-State: AOAM530Qy4snO1hhZy34NxU8lnUZvMe/IRHGHDqBaYIKYJCI2J8pbHB3 eZ5P2Ziv/+sDQa6QIUz7XdDAL6OAPac= X-Google-Smtp-Source: ABdhPJwo4tGE36BFcdCpE8pKNc/zn/kgsKuceJ6cnp2cgoJbYu9vs/jLcAp4RIj5dEVPUiRg61LJeg== X-Received: by 2002:a5d:44c5:: with SMTP id z5mr6033016wrr.319.1616016492063; Wed, 17 Mar 2021 14:28:12 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id v189sm110243wme.39.2021.03.17.14.28.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 14:28:11 -0700 (PDT) Message-Id: <4a79e61346919291f49885298da4b8c714ee00ff.1616016485.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 17 Mar 2021 21:28:01 +0000 Subject: [PATCH v2 09/13] merge-ort: write $GIT_DIR/AUTO_MERGE whenever we hit a conflict Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7A=?= Bjarmason , Taylor Blau , Jonathan Tan , Jeff King , Jonathan Nieder , Johannes Schindelin , Junio C Hamano , Derrick Stolee , Elijah Newren , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren There are a variety of questions users might ask while resolving conflicts: * What changes have been made since the previous (first) parent? * What changes are staged? * What is still unstaged? (or what is still conflicted?) * What changes did I make to resolve conflicts so far? The first three of these have simple answers: * git diff HEAD * git diff --cached * git diff There was no way to answer the final question previously. Adding one is trivial in merge-ort, since it works by creating a tree representing what should be written to the working copy complete with conflict markers. Simply write that tree to .git/AUTO_MERGE, allowing users to answer the fourth question with * git diff AUTO_MERGE I avoided using a name like "MERGE_AUTO", because that would be merge-specific (much like MERGE_HEAD, REBASE_HEAD, REVERT_HEAD, CHERRY_PICK_HEAD) and I wanted a name that didn't change depending on which type of operation the merge was part of. Ensure that paths which clean out other temporary operation-specific files (e.g. CHERRY_PICK_HEAD, MERGE_MSG, rebase-merge/ state directory) also clean out this AUTO_MERGE file. Signed-off-by: Elijah Newren --- branch.c | 1 + builtin/rebase.c | 1 + merge-ort.c | 10 ++++++++++ path.c | 1 + path.h | 2 ++ sequencer.c | 5 +++++ 6 files changed, 20 insertions(+) diff --git a/branch.c b/branch.c index 9c9dae1eae32..b71a2de29dbe 100644 --- a/branch.c +++ b/branch.c @@ -344,6 +344,7 @@ void remove_merge_branch_state(struct repository *r) unlink(git_path_merge_rr(r)); unlink(git_path_merge_msg(r)); unlink(git_path_merge_mode(r)); + unlink(git_path_auto_merge(r)); save_autostash(git_path_merge_autostash(r)); } diff --git a/builtin/rebase.c b/builtin/rebase.c index 840dbd7eb777..6c252d62758c 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -737,6 +737,7 @@ static int finish_rebase(struct rebase_options *opts) int ret = 0; delete_ref(NULL, "REBASE_HEAD", NULL, REF_NO_DEREF); + unlink(git_path_auto_merge(the_repository)); apply_autostash(state_dir_path("autostash", opts)); close_object_store(the_repository->objects); /* diff --git a/merge-ort.c b/merge-ort.c index 303e89414274..e8f1a435f99a 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -3496,6 +3496,9 @@ void merge_switch_to_result(struct merge_options *opt, { assert(opt->priv == NULL); if (result->clean >= 0 && update_worktree_and_index) { + const char *filename; + FILE *fp; + trace2_region_enter("merge", "checkout", opt->repo); if (checkout(opt, head, result->tree)) { /* failure to function */ @@ -3514,6 +3517,13 @@ void merge_switch_to_result(struct merge_options *opt, } opt->priv = NULL; trace2_region_leave("merge", "record_conflicted", opt->repo); + + trace2_region_enter("merge", "write_auto_merge", opt->repo); + filename = git_path_auto_merge(opt->repo); + fp = xfopen(filename, "w"); + fprintf(fp, "%s\n", oid_to_hex(&result->tree->object.oid)); + fclose(fp); + trace2_region_leave("merge", "write_auto_merge", opt->repo); } if (display_update_msgs) { diff --git a/path.c b/path.c index 7b385e5eb282..9e883eb52446 100644 --- a/path.c +++ b/path.c @@ -1534,5 +1534,6 @@ REPO_GIT_PATH_FUNC(merge_rr, "MERGE_RR") REPO_GIT_PATH_FUNC(merge_mode, "MERGE_MODE") REPO_GIT_PATH_FUNC(merge_head, "MERGE_HEAD") REPO_GIT_PATH_FUNC(merge_autostash, "MERGE_AUTOSTASH") +REPO_GIT_PATH_FUNC(auto_merge, "AUTO_MERGE") REPO_GIT_PATH_FUNC(fetch_head, "FETCH_HEAD") REPO_GIT_PATH_FUNC(shallow, "shallow") diff --git a/path.h b/path.h index e7e77da6aaa5..251c78d98000 100644 --- a/path.h +++ b/path.h @@ -176,6 +176,7 @@ struct path_cache { const char *merge_mode; const char *merge_head; const char *merge_autostash; + const char *auto_merge; const char *fetch_head; const char *shallow; }; @@ -191,6 +192,7 @@ const char *git_path_merge_rr(struct repository *r); const char *git_path_merge_mode(struct repository *r); const char *git_path_merge_head(struct repository *r); const char *git_path_merge_autostash(struct repository *r); +const char *git_path_auto_merge(struct repository *r); const char *git_path_fetch_head(struct repository *r); const char *git_path_shallow(struct repository *r); diff --git a/sequencer.c b/sequencer.c index d2332d3e1787..472cdd8c620d 100644 --- a/sequencer.c +++ b/sequencer.c @@ -2096,6 +2096,7 @@ static int do_pick_commit(struct repository *r, refs_delete_ref(get_main_ref_store(r), "", "CHERRY_PICK_HEAD", NULL, 0); unlink(git_path_merge_msg(r)); + unlink(git_path_auto_merge(r)); fprintf(stderr, _("dropping %s %s -- patch contents already upstream\n"), oid_to_hex(&commit->object.oid), msg.subject); @@ -2451,6 +2452,8 @@ void sequencer_post_commit_cleanup(struct repository *r, int verbose) need_cleanup = 1; } + unlink(git_path_auto_merge(r)); + if (!need_cleanup) return; @@ -4111,6 +4114,7 @@ static int pick_commits(struct repository *r, unlink(rebase_path_stopped_sha()); unlink(rebase_path_amend()); unlink(git_path_merge_head(r)); + unlink(git_path_auto_merge(r)); delete_ref(NULL, "REBASE_HEAD", NULL, REF_NO_DEREF); if (item->command == TODO_BREAK) { @@ -4505,6 +4509,7 @@ static int commit_staged_changes(struct repository *r, return error(_("could not commit staged changes.")); unlink(rebase_path_amend()); unlink(git_path_merge_head(r)); + unlink(git_path_auto_merge(r)); if (final_fixup) { unlink(rebase_path_fixup_msg()); unlink(rebase_path_squash_msg()); From patchwork Wed Mar 17 21:28:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 12147013 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=-12.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 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 D1F1DC4321A for ; Wed, 17 Mar 2021 21:28:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA16364F40 for ; Wed, 17 Mar 2021 21:28:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233573AbhCQV2d (ORCPT ); Wed, 17 Mar 2021 17:28:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233536AbhCQV2O (ORCPT ); Wed, 17 Mar 2021 17:28:14 -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 E7AE1C06174A for ; Wed, 17 Mar 2021 14:28:13 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id x16so3313093wrn.4 for ; Wed, 17 Mar 2021 14:28:13 -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=BUOkwACFk1ATS5lxNPwdjLfxguOc0uEUsQow7Zl+Re4=; b=KueQR6GrcVidV1lymzKB36BMqpLNRH2N4uLCnjsHpOkOpKD9y8ARtk+EJZbQjcf156 9mO4UXfiC+8cmspAqk4b/1tlQXGWlV/rHunObrd9mSWdb6EubRNECx5ggurRAx5XrMl+ VGyHMAcfydSfE3MFft5lJ9LMdl0dK96HXiHLUTVvvlRc0epbOM9yqU5Ry/rfvdjqbLAM c30ou6TgS2z2qLkJZNWcVzLed+sATs7ZvUZzFvP5OLC1EedcnSamw/wkiHsrgGT6yJDY B40rHQXDrdfH7iT0rR2KGH0S1R+wUBVJDE7JVzuQDZTUoqqGHRmRn5t2V4Y+F6sFTXEl HsNQ== 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=BUOkwACFk1ATS5lxNPwdjLfxguOc0uEUsQow7Zl+Re4=; b=LHmZCWoSTPF4OZJuWKCptSESfrecpEIYIaqYY4V7DorkRRgJzh+E1CAn4HBpxnXZGl j8CUKlm+d3ij0FEotQQW2AavZgUeqUc1K53QqTHctYxLzWBnJLBDgQeqHcGsF76tM8By aXlXEH5wyGH5iB2JtMew/dZ8M8eNrEWS1A5wLWD8f9SCrc7DOBqytgxAts1npExM3Ibm K+i6NsXQNuJAubDvgKLTA+M0LW5hgS2XZ8cHExilVvL0P6od8K8DRE7KYKgpyO7qYxib nc4YFXeyrFqlKu99gTTp8PlPnFbIK0L0dVk5cPetyYpvpNGA5SQ2M4+pb5n7l0TwjJRv +iYQ== X-Gm-Message-State: AOAM532tu/gX9Ypp1yJZYqDsHxts2b6yOmNXmyU3EZ/W70yax9x4wpkn rLC4ud1drmZNv1CrDc/TaYiuYZHMXQQ= X-Google-Smtp-Source: ABdhPJy/v0fAnr/43Ysf7Fy30FrBOxVtWe7k6/bEWFO8roYQTI59L0Uz1FRkyRNyeUbMbh9GcHdthQ== X-Received: by 2002:a5d:6b84:: with SMTP id n4mr6300352wrx.402.1616016492681; Wed, 17 Mar 2021 14:28:12 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id l4sm205155wrt.60.2021.03.17.14.28.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 14:28:12 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Wed, 17 Mar 2021 21:28:02 +0000 Subject: [PATCH v2 10/13] merge-recursive: add a bunch of FIXME comments documenting known bugs Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7A=?= Bjarmason , Taylor Blau , Jonathan Tan , Jeff King , Jonathan Nieder , Johannes Schindelin , Junio C Hamano , Derrick Stolee , Elijah Newren , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren The plan is to just delete merge-recursive, but not until everyone is comfortable with merge-ort as a replacement. Given that I haven't switched all callers of merge-recursive over yet (e.g. git-am still uses merge-recursive), maybe there's some value documenting known bugs in the algorithm in case we end up keeping it or someone wants to dig it up in the future. Signed-off-by: Elijah Newren --- merge-recursive.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/merge-recursive.c b/merge-recursive.c index b052974f191c..99a197597db5 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -1075,6 +1075,11 @@ static int merge_3way(struct merge_options *opt, read_mmblob(&src1, &a->oid); read_mmblob(&src2, &b->oid); + /* + * FIXME: Using a->path for normalization rules in ll_merge could be + * wrong if we renamed from a->path to b->path. We should use the + * target path for where the file will be written. + */ merge_status = ll_merge(result_buf, a->path, &orig, base, &src1, name1, &src2, name2, opt->repo->index, &ll_opts); @@ -1154,6 +1159,8 @@ static void print_commit(struct commit *commit) struct strbuf sb = STRBUF_INIT; struct pretty_print_context ctx = {0}; ctx.date_mode.type = DATE_NORMAL; + /* FIXME: Merge this with output_commit_title() */ + assert(!merge_remote_util(commit)); format_commit_message(commit, " %h: %m %s", &sb, &ctx); fprintf(stderr, "%s\n", sb.buf); strbuf_release(&sb); @@ -1177,6 +1184,11 @@ static int merge_submodule(struct merge_options *opt, int search = !opt->priv->call_depth; /* store a in result in case we fail */ + /* FIXME: This is the WRONG resolution for the recursive case when + * we need to be careful to avoid accidentally matching either side. + * Should probably use o instead there, much like we do for merging + * binaries. + */ oidcpy(result, a); /* we can not handle deletion conflicts */ @@ -1301,6 +1313,13 @@ static int merge_mode_and_contents(struct merge_options *opt, if ((S_IFMT & a->mode) != (S_IFMT & b->mode)) { result->clean = 0; + /* + * FIXME: This is a bad resolution for recursive case; for + * the recursive case we want something that is unlikely to + * accidentally match either side. Also, while it makes + * sense to prefer regular files over symlinks, it doesn't + * make sense to prefer regular files over submodules. + */ if (S_ISREG(a->mode)) { result->blob.mode = a->mode; oidcpy(&result->blob.oid, &a->oid); @@ -1349,6 +1368,7 @@ static int merge_mode_and_contents(struct merge_options *opt, free(result_buf.ptr); if (ret) return ret; + /* FIXME: bug, what if modes didn't match? */ result->clean = (merge_status == 0); } else if (S_ISGITLINK(a->mode)) { result->clean = merge_submodule(opt, &result->blob.oid, @@ -2664,6 +2684,14 @@ static int process_renames(struct merge_options *opt, struct string_list b_by_dst = STRING_LIST_INIT_NODUP; const struct rename *sre; + /* + * FIXME: As string-list.h notes, it's O(n^2) to build a sorted + * string_list one-by-one, but O(n log n) to build it unsorted and + * then sort it. Note that as we build the list, we do not need to + * check if the existing destination path is already in the list, + * because the structure of diffcore_rename guarantees we won't + * have duplicates. + */ for (i = 0; i < a_renames->nr; i++) { sre = a_renames->items[i].util; string_list_insert(&a_by_dst, sre->pair->two->path)->util @@ -3602,6 +3630,15 @@ static int merge_recursive_internal(struct merge_options *opt, return err(opt, _("merge returned no commit")); } + /* + * FIXME: Since merge_recursive_internal() is only ever called by + * places that ensure the index is loaded first + * (e.g. builtin/merge.c, rebase/sequencer, etc.), in the common + * case where the merge base was unique that means when we get here + * we immediately discard the index and re-read it, which is a + * complete waste of time. We should only be discarding and + * re-reading if we were forced to recurse. + */ discard_index(opt->repo->index); if (!opt->priv->call_depth) repo_read_index(opt->repo); From patchwork Wed Mar 17 21:28:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 12147017 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=-12.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 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 021A2C432C3 for ; Wed, 17 Mar 2021 21:28:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D0FE264F2A for ; Wed, 17 Mar 2021 21:28:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233570AbhCQV2c (ORCPT ); Wed, 17 Mar 2021 17:28:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233538AbhCQV2O (ORCPT ); Wed, 17 Mar 2021 17:28:14 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B4CCC06174A for ; Wed, 17 Mar 2021 14:28:14 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id t9so3297484wrn.11 for ; Wed, 17 Mar 2021 14:28:14 -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=vNEoqUX4A42360elOoDcA6cH0Od98QxzvF2EIqCVNu4=; b=eqN1OVtMv2LxrRzQnv3ncBCFRsJ/l6kJlfKznQEZbvABrFJ6RdJ1o2PF7NtRHFv591 ElA+//KAhq1VWwX162sMzgpSd1XcOSgq6q662MoI3UD2DOYXSiUOxHmcH/m7qsJZGL5L ByjZf0RDJb8W8FybP5CQduOGwy09ZCirqJZWBTL5RnYkR3tJYcfO0Xz6/2pfiO5pwBdZ 4fhMYKckMkPr5GdwD3UaHyNaa/lx0/cwASuSosOXBHP/UYAC/2dog/1XjhmDBBdjOvwK vvezI6K1zOlMFc/9fF0W5P38ibUDI+suY27PfUsvCRZrlAOoFB+PQjgoB56xxkPWtPws 7Y8w== 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=vNEoqUX4A42360elOoDcA6cH0Od98QxzvF2EIqCVNu4=; b=Wr+S76uTvH+/hLgMXP0pNAbhvVHuEeT5cdAA/FGmeDTbOFQy8gRIHVeE8sdTxyLEJg 9EgRQboQFqya2hsYA8PoqMHuPebDhxhWGfC5G0N4awDEiz9fuvjXqKQ9tWEu4tal4V7A HDwST2yyO+OroKu49LBZkw2ip7gK50cXa1BWqKBFmfs8A2BhGkUF/EGweq4f0DvkTOvc ruKSNwnR3mpEDdQgHLLYCKmZCyrBIXdppYfwuKKzqe7Ng2gGDUj/2XctZ7EMjQIl0mkc NGaBepc/p8hHVwLjoWpGeX/ESjrMt64rsXCiqcOXUxh3xw8NO9bc/kWr7tn5xKVTIeKZ M9cg== X-Gm-Message-State: AOAM530jbCbsCE0qd4iaTUI2t8ZdQuEFujqxejc72sin8wYO3NXwVoEp XpMW3WqCy7fZxLHMBMM9NDezjW3ft4w= X-Google-Smtp-Source: ABdhPJzGocMlBK/7lGQcCgJlT8tCoAXpK/lyFwTVe2ei0/B+u1RUkOzZjMqX1fm8k264HryvuUI9iA== X-Received: by 2002:a5d:53c8:: with SMTP id a8mr6210666wrw.323.1616016493236; Wed, 17 Mar 2021 14:28:13 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id s20sm104709wmj.36.2021.03.17.14.28.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 14:28:12 -0700 (PDT) Message-Id: <6bda855f29806475be14d133e185fec222c8b0be.1616016485.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 17 Mar 2021 21:28:03 +0000 Subject: [PATCH v2 11/13] Revert "merge-ort: ignore the directory rename split conflict for now" Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7A=?= Bjarmason , Taylor Blau , Jonathan Tan , Jeff King , Jonathan Nieder , Johannes Schindelin , Junio C Hamano , Derrick Stolee , Elijah Newren , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren This reverts commit 5ced7c3da009090c5a926e3123a71314c7f28d42, which was put in place as a temporary measure to avoid optimizations unstably erroring out on no destination having a majority of the necessary renames for directories that had no new files and thus no need for directory rename detection anyway. Now that optimizations are in place to prevent us from trying to compute directory rename count computations for directories that do not need it, we can undo this temporary measure. Signed-off-by: Elijah Newren --- merge-ort.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/merge-ort.c b/merge-ort.c index e8f1a435f99a..8258d3fd621e 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -1636,18 +1636,7 @@ static void get_provisional_directory_renames(struct merge_options *opt, "no destination getting a majority of the " "files."), source_dir); - /* - * We should mark this as unclean IF something attempts - * to use this rename. We do not yet have the logic - * in place to detect if this directory rename is being - * used, and optimizations that reduce the number of - * renames cause this to falsely trigger. For now, - * just disable it, causing t6423 testcase 2a to break. - * We'll later fix the detection, and when we do we - * will re-enable setting *clean to 0 (and thereby fix - * t6423 testcase 2a). - */ - /* *clean = 0; */ + *clean = 0; } else { strmap_put(&renames->dir_renames[side], source_dir, (void*)best); From patchwork Wed Mar 17 21:28:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 12147019 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=-12.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 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 589BBC4360C for ; Wed, 17 Mar 2021 21:28:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 269DE64F30 for ; Wed, 17 Mar 2021 21:28:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233576AbhCQV2e (ORCPT ); Wed, 17 Mar 2021 17:28:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233540AbhCQV2P (ORCPT ); Wed, 17 Mar 2021 17:28:15 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12B97C06174A for ; Wed, 17 Mar 2021 14:28:15 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id x16so3313124wrn.4 for ; Wed, 17 Mar 2021 14:28:15 -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=X/O9ei5Y/8+fu/a0CsKzzM5LD1f+vsoxe0VE60ZU1dc=; b=Hs50xW88zNoEJDKG+utEpqSuW/yt5jhp+kCaeDg+TGwo7Ze4eTsEY6ZFsyzb7xLnf1 pDb8IMkmKuZMzgMzZRI6WFBFl8NI5kRf5cdQxhj6+1slZnV0w9GsPTfXbrb38pl8NwPK GVg8QjHuFBWxrw7WJ9U/OWnbJGGdcXAQj+1yPC+ow7vSx4J1jMuYz3pjEZqKWyFVrCtl 23uDjxvyaIaiFywY+Vx70OPKnODaA2B56Ovy5CBlF3cST2KUC6PVK4SK2naNk3pGtUBT fW2A5KnKl2zoafgLtFFWov81K3j+iVyEOHW/FR+MLYqIVuAOZm1AivAR7yzaTpk/m/S9 fJuA== 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=X/O9ei5Y/8+fu/a0CsKzzM5LD1f+vsoxe0VE60ZU1dc=; b=c01cCwLZko0Z/zCVwvho+OvAjG4XjzLHV9sSIxz1UYyrli7+D2kNAGTZa7E3aCUXfZ psdxd17mpQrVzUux4VyOZxKDCcckp9dy0qxIqa0HpPENfW53M7kCp1iaR7aZSFghmtiI y/MaXARtl7rKE4EZpXR0xNnziV7ryvrMo1OrVbgMgirVoIscf1FsY2yIT+C6v0adgJMq x6d2Dp0cmOb+x1me9ufvlOBrI0j2ohMoo2U/gTR8m5lqLESQ3591cjIgs19AsSFGbaUk smzXY4+DGPsoB5+0bwDs0makHdeyJFoFc7tubz4q9pUo6nK2qtaG3wpdpXGmhXwGpbmB QhKA== X-Gm-Message-State: AOAM533H4w3cE0oJHB8wwlQxRKDukH2I5gFnq+k9DTECnDYNo0XaKxxi xqfHa8LtxLo0yZBT8bD0yC1VFZJIAm0= X-Google-Smtp-Source: ABdhPJzmGwFPWyw8qePfH4QdVXLenEeymJHyD8+z6AdilfO9XPFyzfSnnapM9q98isba94ALSQGXZA== X-Received: by 2002:adf:ef4a:: with SMTP id c10mr6168366wrp.427.1616016493869; Wed, 17 Mar 2021 14:28:13 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id n6sm257578wrw.63.2021.03.17.14.28.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 14:28:13 -0700 (PDT) Message-Id: <1c6361c9b88ac5f970054989bae0845ef3b6baee.1616016485.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 17 Mar 2021 21:28:04 +0000 Subject: [PATCH v2 12/13] t6423: mark remaining expected failure under merge-ort as such Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7A=?= Bjarmason , Taylor Blau , Jonathan Tan , Jeff King , Jonathan Nieder , Johannes Schindelin , Junio C Hamano , Derrick Stolee , Elijah Newren , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren When we started on merge-ort, thousands of tests failed when run with the GIT_TEST_MERGE_ALGORITHM=ort flag; with so many, it didn't make sense to flip all their test expectations. The ones in t6409, t6418, and the submodule tests are being handled by an independent in-flight topic ("Complete merge-ort implemenation...almost"). The ones in t6423 were left out of the other series because other ongoing series that this commit depends upon were addressing those. Now that we only have one remaining test failure in t6423, let's mark it as such. This remaining test will be fixed by a future optimization series, but since merge-recursive doesn't pass this test either, passing it is not necessary for declaring merge-ort ready for general use. Signed-off-by: Elijah Newren --- t/t6423-merge-rename-directories.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t6423-merge-rename-directories.sh b/t/t6423-merge-rename-directories.sh index 4c568050dd27..4c3d0b95dc5c 100755 --- a/t/t6423-merge-rename-directories.sh +++ b/t/t6423-merge-rename-directories.sh @@ -4797,7 +4797,7 @@ test_setup_12f () { ) } -test_expect_merge_algorithm failure success '12f: Trivial directory resolve, caching, all kinds of fun' ' +test_expect_merge_algorithm failure failure '12f: Trivial directory resolve, caching, all kinds of fun' ' test_setup_12f && ( cd 12f && From patchwork Wed Mar 17 21:28:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 12147021 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=-12.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 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 29D63C43603 for ; Wed, 17 Mar 2021 21:28:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F3FEF64F3B for ; Wed, 17 Mar 2021 21:28:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233582AbhCQV2e (ORCPT ); Wed, 17 Mar 2021 17:28:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233541AbhCQV2Q (ORCPT ); Wed, 17 Mar 2021 17:28:16 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5D1AC06175F for ; Wed, 17 Mar 2021 14:28:15 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id z2so3308596wrl.5 for ; Wed, 17 Mar 2021 14:28:15 -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=+xOuyHuwEJ7xExcXUDqaEEbFiL0moeTL9ZTKBxI7icE=; b=n4UHrgek/Qkj3Ru+XKs57x6DgKmFyMjgmM9ENQR3rfsNNDm6JbRa913ki5TPhRkuPG oxxALr95aWdo80Ct5gwcPZwRg8XdWruGrb13s0vHqJLoek1MPrGPsGONUk5qguQ2AWeM 5hMENXwxZ0kcP69ZpXdItVzzB8vYSvqEb6ALxitRfCRij9ViNSOp/usZtPA4tYqw22Ia 9/UzAoX7q/iso8GDpKYxkz24dcpu+1HFZHZDCP5ks0/du+vzt/iZb00/mBGefTZHJFU0 fCsuXDgvDC0HVZLEbiLU/srJ6Wd45uPqUlznGvPHoEvngOsAgBmYlat06vxkVLrluzYK 22zQ== 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=+xOuyHuwEJ7xExcXUDqaEEbFiL0moeTL9ZTKBxI7icE=; b=m0U8KtxrO3laa9HPm5+fwIyTIn9HlK1fpVmKKmZYxnHfTpiuUr94WcQoW3AMvS6XUT NjL6XAfU849/ygyP1G4+MFLNfuv0AcpauQMpU1aFxhs82vBAxnbydX7GxHDs6ZrcJXEj Eaa5oL8eBUi8e/Y1+KU72qNx9zEhm4VUF1HmhXI5BhtPKPsrR+hZfW/r0xvIIlo7ot2U bUiUqojHYmoefv9J9lm1k2ULmkE5yYa4Mrk5773es4PzwRuE07e0Yt1UfLkyZ1DL6vZM Ti61nuX20PSLA7YOUp04yvMx8ysiVi4DDWthKxZta8u4cCzXFbdN7sy+fcid+NAIX/BX JdIQ== X-Gm-Message-State: AOAM532mXhHOey5WVdDiyAGmTk+ghmT43FB+2OS9pQhFQieJCZztK6gu QpEISwJE3pf88etT7+HvTE5+TBG99Mg= X-Google-Smtp-Source: ABdhPJycovraj3Rc3rjsz7yyiY11G2ppohNPcYXTKlGzxjy75AWlsh4CaSJReoZjOE9NRFF+5DT8wA== X-Received: by 2002:a5d:6342:: with SMTP id b2mr6257108wrw.421.1616016494475; Wed, 17 Mar 2021 14:28:14 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id h62sm122148wmf.37.2021.03.17.14.28.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 14:28:14 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Wed, 17 Mar 2021 21:28:05 +0000 Subject: [PATCH v2 13/13] Add testing with merge-ort merge strategy Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7A=?= Bjarmason , Taylor Blau , Jonathan Tan , Jeff King , Jonathan Nieder , Johannes Schindelin , Junio C Hamano , Derrick Stolee , Elijah Newren , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren In preparation for switching from merge-recursive to merge-ort as the default strategy, ensure that we are testing it. Signed-off-by: Elijah Newren --- .github/workflows/main.yml | 1 + ci/lib.sh | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5f2f884b92f6..e1f59861a2ca 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -252,6 +252,7 @@ jobs: MSYSTEM: MINGW64 NO_SVN_TESTS: 1 GIT_TEST_SKIP_REBASE_P: 1 + GIT_TEST_MERGE_ALGORITHM: ort run: | & .\git-sdk-64-minimal\usr\bin\bash.exe -lc @" # Let Git ignore the SDK and the test-cache diff --git a/ci/lib.sh b/ci/lib.sh index d848c036c50f..2a869b598c7f 100755 --- a/ci/lib.sh +++ b/ci/lib.sh @@ -182,6 +182,12 @@ export DEFAULT_TEST_TARGET=prove export GIT_TEST_CLONE_2GB=true export SKIP_DASHED_BUILT_INS=YesPlease +case "$jobname" in +*-gcc) + export GIT_TEST_MERGE_ALGORITHM=ort + ;; +esac + case "$jobname" in linux-clang|linux-gcc) if [ "$jobname" = linux-gcc ]