From patchwork Fri Aug 19 06:57:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12948447 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A02B7C25B0E for ; Fri, 19 Aug 2022 06:57:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346711AbiHSG5q (ORCPT ); Fri, 19 Aug 2022 02:57:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346678AbiHSG5m (ORCPT ); Fri, 19 Aug 2022 02:57:42 -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 604EBDF081 for ; Thu, 18 Aug 2022 23:57:40 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id bs25so4111916wrb.2 for ; Thu, 18 Aug 2022 23:57:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc; bh=0jNjk4dN/9JIw6xcGiAVLQioJPRreWy7xIvALrTCQL0=; b=GaptEPQNU0Dsv15+JIOmc8FtXEcpWkS/sgfS6SQeVj3BToOmORhGuFHjvqwdWAg4H3 bfiY01aBlXGZjtjsQ9uZzUTxPDBRyiIFm82i4DtxJs4h9iLTUrlhhA/yS09rGPTmgmcp b+2ozxhjgtcMPs9w+RzDcMtJZfRSaVuHuC5c8qgv4miZ3Wvk0N7HmeIrvQPhQli65YwL IgBK3RYY526x8hSAyhGfnlCfScNhUE+4M4RXvykTA/kafCYfeC0jzfzxBgll8zKPq2xr +YSxT6F21pCVcHTpLR5Ce4jtcl50UJCCVeGwwVHaCqNo0dEJFLLW1fIEWEySh4EVhACv R5JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc; bh=0jNjk4dN/9JIw6xcGiAVLQioJPRreWy7xIvALrTCQL0=; b=NZz6SvPIytNp7atcyXLt3R66h/zfyF+0gXz6ZwG/RDmOlYjujUBKhFd3ZfvyvyLGHU rFSAJ+DpXj74a9+flF2qEFBSBoC/oN3PKPb1HIb+jPLgmDhjpZOV9eKRTHAx6Pov5eXz rF8/a7KjGu3Zpmy/7o0dtSa15QnSFYpvdTg3ib+3eLD7q67J7PYTeIzMqQKgbPpCbReM HtE0drgQNjBWCofW1wRnAWMVG07wMOQHgJ3KC2J463gz1cEbWjTkRvqybemwwgWuC6lp YGbyk8N1BQoypW+ml+Isj+ZH7UbYfICntidFbz+SJ8erglHgImPqhaaPUJfvy8wIs2Cl 5HEQ== X-Gm-Message-State: ACgBeo0vMl20HCdE8scX5h8W3t6Cpqh1B263jelfqpXJflq9m4+/kDbu xk+tuGRbJ8BY0efpOZTH2SZn+lBSkNg= X-Google-Smtp-Source: AA6agR7MFObRhFpcWfvgLIxSN0wW9C6liLMGEQxFMJgQQRZj0h248DEIHtnwfp7U4cUaJcWwc3cEzQ== X-Received: by 2002:a5d:6c6b:0:b0:225:dde:ab40 with SMTP id r11-20020a5d6c6b000000b002250ddeab40mr3319460wrz.690.1660892258567; Thu, 18 Aug 2022 23:57:38 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id m128-20020a1c2686000000b003a5dbdea6a8sm9067930wmm.27.2022.08.18.23.57.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Aug 2022 23:57:37 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Fri, 19 Aug 2022 06:57:34 +0000 Subject: [PATCH 1/3] merge-tree -z: always show the original file name first Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin When printing the messages in a machine-readable format (i.e. in `-z` mode), the intention is to support third-party software that wants to present the conflicts in a "pretty" way to human readers. To that end, `git merge-tree -z` prefixes the conflict messages by a variable-size list of paths and a conflict identifier. This list and this identifier are intended to be machine-parseable, the conflict message is sort of free-form and not intended to be parsed. Keeping in mind that the intended use case is to have third-party software use `git merge-tree` to perform worktree-less merges and then present the conflicts (if any) to human readers, it makes much more sense to show the original file names of the involved files instead of the ones we internally munged to allow for creating a tree object that contains entries for both sides of the conflict (which requires them to have different names). So let's mention the original file names prominently, as first item in that variable-size list of paths. Note: For the modify/delete conflict type, we used to mention _only_ the munged name in that path list. To allow for tools to read the tree object produced by `git merge-tree -z` into a Git index in order to resolve the conflicts, it is necessary to list not only the original name but _also_ the munged name so that the item with the munged file name can be removed from that Git index. Therefore, this patch teaches `git merge-tree` to show both the original _and_ the munged name in that list. Also note: This patch changes the output of the remerge diff slightly: whereas before, we printed the notice about a file/directory conflict under the diff header mentioning the munged file name, we now print it under a separate diff header that mentions the original file name. That is the explanation why t4301 is touched by this patch. Signed-off-by: Johannes Schindelin --- merge-ort.c | 14 +++++++------- t/t4069-remerge-diff.sh | 8 ++++---- t/t4301-merge-tree-write-tree.sh | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/merge-ort.c b/merge-ort.c index 01f150ef3b5..211f6823e1d 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -3741,6 +3741,7 @@ static void process_entry(struct merge_options *opt, struct conflict_info *ci, struct directory_versions *dir_metadata) { + const char *orig_path = path; int df_file_index = 0; VERIFY_CI(ci); @@ -3787,7 +3788,6 @@ static void process_entry(struct merge_options *opt, */ struct conflict_info *new_ci; const char *branch; - const char *old_path = path; int i; assert(ci->merged.result.mode == S_IFDIR); @@ -3838,10 +3838,10 @@ static void process_entry(struct merge_options *opt, strmap_put(&opt->priv->paths, path, new_ci); path_msg(opt, CONFLICT_FILE_DIRECTORY, 0, - path, old_path, NULL, NULL, + orig_path, path, NULL, NULL, _("CONFLICT (file/directory): directory in the way " "of %s from %s; moving it to %s instead."), - old_path, branch, path); + orig_path, branch, path); /* * Zero out the filemask for the old ci. At this point, ci @@ -3921,7 +3921,7 @@ static void process_entry(struct merge_options *opt, if (rename_a && rename_b) { path_msg(opt, CONFLICT_DISTINCT_MODES, 0, - path, a_path, b_path, NULL, + orig_path, a_path, b_path, NULL, _("CONFLICT (distinct types): %s had " "different types on each side; " "renamed both of them so each can " @@ -3929,7 +3929,7 @@ static void process_entry(struct merge_options *opt, path); } else { path_msg(opt, CONFLICT_DISTINCT_MODES, 0, - path, rename_a ? a_path : b_path, + orig_path, rename_a ? a_path : b_path, NULL, NULL, _("CONFLICT (distinct types): %s had " "different types on each side; " @@ -4022,7 +4022,7 @@ static void process_entry(struct merge_options *opt, if (S_ISGITLINK(merged_file.mode)) reason = _("submodule"); path_msg(opt, CONFLICT_CONTENTS, 0, - path, NULL, NULL, NULL, + orig_path, NULL, NULL, NULL, _("CONFLICT (%s): Merge conflict in %s"), reason, path); } @@ -4067,7 +4067,7 @@ static void process_entry(struct merge_options *opt, */ } else { path_msg(opt, CONFLICT_MODIFY_DELETE, 0, - path, NULL, NULL, NULL, + orig_path, path, NULL, NULL, _("CONFLICT (modify/delete): %s deleted in %s " "and modified in %s. Version %s of %s left " "in tree."), diff --git a/t/t4069-remerge-diff.sh b/t/t4069-remerge-diff.sh index 35f94957fce..bc580a242ac 100755 --- a/t/t4069-remerge-diff.sh +++ b/t/t4069-remerge-diff.sh @@ -131,11 +131,12 @@ test_expect_success 'setup non-content conflicts' ' test_expect_success 'remerge-diff with non-content conflicts' ' git log -1 --oneline resolution >tmp && cat <<-EOF >>tmp && + diff --git a/file_or_directory b/file_or_directory + remerge CONFLICT (file/directory): directory in the way of file_or_directory from HASH (side1); moving it to file_or_directory~HASH (side1) instead. diff --git a/file_or_directory~HASH (side1) b/wanted_content similarity index 100% rename from file_or_directory~HASH (side1) rename to wanted_content - remerge CONFLICT (file/directory): directory in the way of file_or_directory from HASH (side1); moving it to file_or_directory~HASH (side1) instead. diff --git a/letters b/letters remerge CONFLICT (rename/rename): letters renamed to letters_side1 in HASH (side1) and to letters_side2 in HASH (side2). diff --git a/letters_side2 b/letters_side2 @@ -168,7 +169,7 @@ test_expect_success 'remerge-diff with non-content conflicts' ' test_expect_success 'remerge-diff w/ diff-filter=U: all conflict headers, no diff content' ' git log -1 --oneline resolution >tmp && cat <<-EOF >>tmp && - diff --git a/file_or_directory~HASH (side1) b/file_or_directory~HASH (side1) + diff --git a/file_or_directory b/file_or_directory remerge CONFLICT (file/directory): directory in the way of file_or_directory from HASH (side1); moving it to file_or_directory~HASH (side1) instead. diff --git a/letters b/letters remerge CONFLICT (rename/rename): letters renamed to letters_side1 in HASH (side1) and to letters_side2 in HASH (side2). @@ -184,14 +185,13 @@ test_expect_success 'remerge-diff w/ diff-filter=U: all conflict headers, no dif test_cmp expect actual ' -test_expect_success 'remerge-diff w/ diff-filter=R: relevant file + conflict header' ' +test_expect_success 'remerge-diff w/ diff-filter=R: relevant file' ' git log -1 --oneline resolution >tmp && cat <<-EOF >>tmp && diff --git a/file_or_directory~HASH (side1) b/wanted_content similarity index 100% rename from file_or_directory~HASH (side1) rename to wanted_content - remerge CONFLICT (file/directory): directory in the way of file_or_directory from HASH (side1); moving it to file_or_directory~HASH (side1) instead. EOF # We still have some sha1 hashes above; rip them out so test works # with sha256 diff --git a/t/t4301-merge-tree-write-tree.sh b/t/t4301-merge-tree-write-tree.sh index f091259a55e..e0ef9724b2b 100755 --- a/t/t4301-merge-tree-write-tree.sh +++ b/t/t4301-merge-tree-write-tree.sh @@ -211,8 +211,8 @@ test_expect_success 'NUL terminated conflicted file "lines"' ' q_to_nul <<-EOF >>expect && 1QgreetingQAuto-mergingQAuto-merging greeting Q1QgreetingQCONFLICT (contents)QCONFLICT (content): Merge conflict in greeting - Q2Qwhatever~tweak1QwhateverQCONFLICT (file/directory)QCONFLICT (file/directory): directory in the way of whatever from tweak1; moving it to whatever~tweak1 instead. - Q1Qwhatever~tweak1QCONFLICT (modify/delete)QCONFLICT (modify/delete): whatever~tweak1 deleted in side2 and modified in tweak1. Version tweak1 of whatever~tweak1 left in tree. + Q2QwhateverQwhatever~tweak1QCONFLICT (file/directory)QCONFLICT (file/directory): directory in the way of whatever from tweak1; moving it to whatever~tweak1 instead. + Q2QwhateverQwhatever~tweak1QCONFLICT (modify/delete)QCONFLICT (modify/delete): whatever~tweak1 deleted in side2 and modified in tweak1. Version tweak1 of whatever~tweak1 left in tree. Q1QΑυτά μου φαίνονται κινέζικαQAuto-mergingQAuto-merging Αυτά μου φαίνονται κινέζικα Q1QΑυτά μου φαίνονται κινέζικαQCONFLICT (contents)QCONFLICT (content): Merge conflict in Αυτά μου φαίνονται κινέζικα Q From patchwork Fri Aug 19 06:57:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12948448 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F359AC32771 for ; Fri, 19 Aug 2022 06:57:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346694AbiHSG5s (ORCPT ); Fri, 19 Aug 2022 02:57:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346705AbiHSG5m (ORCPT ); Fri, 19 Aug 2022 02:57:42 -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 B10EADEB7E for ; Thu, 18 Aug 2022 23:57:41 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id a4so4116361wrq.1 for ; Thu, 18 Aug 2022 23:57:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc; bh=k+YQm5R+vJvxkKiLzppssk3yy/WO9EqnSCIb1jR/2KU=; b=RFYyLFygqYgU+fGpWx5gOcgGHq7/dINMCV4pgfgkmAPfTCql8GpapvD5V4utnnBOWH LIJtZsc/aIassjHkUznesgnq34+kKXYF5IqUFORWc7D8BjAjLhMWWnB41cFwIJ3U/mRl 5FKFgq/ruXEgJ0/xz31R9NaB8MJzlJvfzd3qRSGYPnpPGdz1YPLgbg9C3L7Rw7GCiqf/ 5rkqs+FKjdxVnRT561idxe/MseAfixQfWGKiJbSBxlqvp19zdXvaPGyn5EDgsAYh1V9Q Gqv1/UINBfPSSPsK1Ntmq9b100RVw4Npye2OfInseQh67o3YzuXqU+ZNEGM0WSc5yOMj ZO/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc; bh=k+YQm5R+vJvxkKiLzppssk3yy/WO9EqnSCIb1jR/2KU=; b=n6YLBPfO/9j47v/VvYLQugneKsIVXwtrjRANFy8CynkJhIhH7Z81oZG30OvAYoyPz4 vH2J35v5RdLGD3DBMfBq3t3SBw09P0dIUUFkPzihdk7A3kgg8eA379JPzMKnw31WtxCC koSxanygax9+mvpOagjQQfLu4+5ReDjO/aHBnU5mAtWhRDa7GUzhDMaLHRGyeWKQyEGk WwNxtbYKvLS2RPb4WfHPQkVFMMo3Z/1HJHwqUPeMDPdDiSV91Y9R5M6hfh6IpG6G8Yfi caj/dVN55X7KcGN2lMjBnMLkDoSN8cxHorzUCPgU6jmuwwY6HRrtKDeRB2GI81TtRYNa jSyA== X-Gm-Message-State: ACgBeo2aGdcOmMNo4X6ToXdpzvdU/mx/srTjofCcwD9n0ZcV8rDc/efW 7gizjZgRKbYqVRfyHCzkasAks1OW1J4= X-Google-Smtp-Source: AA6agR6giIA0c2GTLdXqjM79dzhIK071RHVTrsPcdi7jOUySGNi+862QcN9USIndneHKMXxwK8dcSw== X-Received: by 2002:a5d:47c4:0:b0:21f:e92:7ba1 with SMTP id o4-20020a5d47c4000000b0021f0e927ba1mr3242531wrc.408.1660892259867; Thu, 18 Aug 2022 23:57:39 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id f2-20020a1cc902000000b003a5f783abb8sm7461083wmb.30.2022.08.18.23.57.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Aug 2022 23:57:39 -0700 (PDT) Message-Id: <3aa390f3007f7f15e780bc9b36159846104be32e.1660892256.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 19 Aug 2022 06:57:35 +0000 Subject: [PATCH 2/3] merge-tree: show the original file names in the conflict output Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin When showing the conflict output in an `ls-files -u`-style form, it makes sense to show conflicted files' names in the form that they were written on disk (for example, in case of a file/directory conflict, we would have written the file under a different name by appending a `~` suffix). However, when the intention is to perform a worktree-less merge, this makes less sense, and causes more confusion than is necessary. Let's show the original file names instead. This patch also fixes a bug where the output of conflicts involving a rename did not always show the correct file name for the respective stages. Signed-off-by: Johannes Schindelin --- builtin/merge-tree.c | 2 +- merge-ort.c | 2 +- merge-ort.h | 1 + t/t4301-merge-tree-write-tree.sh | 18 +++++++++--------- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c index ae5782917b9..8cd9ce399aa 100644 --- a/builtin/merge-tree.c +++ b/builtin/merge-tree.c @@ -454,8 +454,8 @@ static int real_merge(struct merge_tree_options *o, merge_get_conflicted_files(&result, &conflicted_files); for (i = 0; i < conflicted_files.nr; i++) { - const char *name = conflicted_files.items[i].string; struct stage_info *c = conflicted_files.items[i].util; + const char *name = c->path; if (!o->name_only) printf("%06o %s %d\t", c->mode, oid_to_hex(&c->oid), c->stage); diff --git a/merge-ort.c b/merge-ort.c index 211f6823e1d..ed72d2e338e 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -4488,7 +4488,7 @@ void merge_get_conflicted_files(struct merge_result *result, if (!(ci->filemask & (1ul << i))) continue; - si = xmalloc(sizeof(*si)); + FLEX_ALLOC_STR(si, path, ci->pathnames[i]); si->stage = i+1; si->mode = ci->stages[i].mode; oidcpy(&si->oid, &ci->stages[i].oid); diff --git a/merge-ort.h b/merge-ort.h index a994c9a5fcd..595031fbab9 100644 --- a/merge-ort.h +++ b/merge-ort.h @@ -94,6 +94,7 @@ struct stage_info { struct object_id oid; int mode; int stage; + const char path[FLEX_ARRAY]; }; /* diff --git a/t/t4301-merge-tree-write-tree.sh b/t/t4301-merge-tree-write-tree.sh index e0ef9724b2b..e08452a8531 100755 --- a/t/t4301-merge-tree-write-tree.sh +++ b/t/t4301-merge-tree-write-tree.sh @@ -125,7 +125,7 @@ test_expect_success 'test conflict notices and such' ' cat <<-EOF >expect && HASH greeting - whatever~side1 + whatever Auto-merging greeting CONFLICT (content): Merge conflict in greeting @@ -153,7 +153,7 @@ test_expect_success 'Just the conflicted files without the messages' ' test_expect_code 1 git merge-tree --write-tree --no-messages --name-only side1 side2 >out && anonymize_hash out >actual && - test_write_lines HASH greeting whatever~side1 >expect && + test_write_lines HASH greeting whatever >expect && test_cmp expect actual ' @@ -168,14 +168,14 @@ test_expect_success 'Check conflicted oids and modes without messages' ' 100644 HASH 1Qgreeting 100644 HASH 2Qgreeting 100644 HASH 3Qgreeting - 100644 HASH 1Qwhatever~side1 - 100644 HASH 2Qwhatever~side1 + 100644 HASH 1Qwhatever + 100644 HASH 2Qwhatever EOF test_cmp expect actual && # Check the actual hashes against the `ls-files -u` output too - tail -n +2 out | sed -e s/side1/HEAD/ >actual && + tail -n +2 out | sed -e s/whatever/whatever~HEAD/ >actual && test_cmp conflicted-file-info actual ' @@ -200,11 +200,11 @@ test_expect_success 'NUL terminated conflicted file "lines"' ' 100644 HASH 1Qgreeting 100644 HASH 2Qgreeting 100644 HASH 3Qgreeting - 100644 HASH 1Qwhatever~tweak1 - 100644 HASH 2Qwhatever~tweak1 - 100644 HASH 1QΑυτά μου φαίνονται κινέζικα + 100644 HASH 1Qwhatever + 100644 HASH 2Qwhatever + 100644 HASH 1Qnumbers 100644 HASH 2QΑυτά μου φαίνονται κινέζικα - 100644 HASH 3QΑυτά μου φαίνονται κινέζικα + 100644 HASH 3Qnumbers EOF From patchwork Fri Aug 19 06:57:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12948449 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C4D0C25B0E for ; Fri, 19 Aug 2022 06:57:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346721AbiHSG5u (ORCPT ); Fri, 19 Aug 2022 02:57:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345973AbiHSG5n (ORCPT ); Fri, 19 Aug 2022 02:57:43 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81E4EDF081 for ; Thu, 18 Aug 2022 23:57:42 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id e20so3612289wri.13 for ; Thu, 18 Aug 2022 23:57:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc; bh=Y5XRwZYJ60SnP3PeQdhQBpF925vx06drV8D29y26RyU=; b=Fp7JX/f03U6MSO276nCAqTZjmpqwz76sfu6xe4UoDR3nOS/CjjQuyx6fa8eJERqXYO 4BAXHwv7Pd69e6dn5pXIKbE857dqY9dqzhm7GVFQTpry/YIOZ7NSxeXTMg6wUvnzKI9e +ft6QKYIHnlWh3j502RfS3yiOVY+JXmljkG4dRmjk8gHbpaa3y6/S0vnd4lMSYsltZWA 0qEiK1NNBIiVRNIbG3JuLTxVKEsOjbUadFDvBeEyd7YpsPd5vqyHEqBStufHDgtWgbqw qgQgFIDoV4/nqadrqkg5EbjRzPeWANFqo2NVjghDEGIKAOJBzmS2qBglbO+arHHH2CiR M1wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc; bh=Y5XRwZYJ60SnP3PeQdhQBpF925vx06drV8D29y26RyU=; b=0Ds1T3N/fU2s84lfML32spoOCWe274OtjkEMRMRE/Ens2jnMOUlJNWABZKbG3YV1N3 DRfEdTDy89V0WWctduaGh7EyqSPO7aC56jF5by0i5unHUl34IcU9TxT1qHumAVbRmGYe Ryc2b7BjRlRcnIln3XZsI+FXDTaqUTo+O3j4k8FhZc7DzSIFQx85MG470YSl89+CK53W PiUCMaSbJQsFdlWQBMNFbYRpoLIjr9CC/Ho0XCxEsdEE9mVejeYG3MB+5dlx1TLOH1If Qo5UMcYGEyx7u/cC0/fihxSaapaBHYWnbm8pKzVl+9+cG9aPiYi1+l1FkXeLyzzjmjoj 65/Q== X-Gm-Message-State: ACgBeo2XZd2DdQ3GkTrR934Yvpq+R9UttDrl3ZpUpx2BWvaXQcoKZWlo A7dxkcaimPl9yvGBU/u4YN2TFwEp9zA= X-Google-Smtp-Source: AA6agR7jP4KhmnOldnqoGa3Yvji8fjXfiMN5VFHqJTVGt2jf3epaSl0J83yEvSXO1NllDyGutw24OQ== X-Received: by 2002:adf:d1e8:0:b0:223:bca:8019 with SMTP id g8-20020adfd1e8000000b002230bca8019mr3267915wrd.562.1660892260811; Thu, 18 Aug 2022 23:57:40 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id g12-20020a05600c4ecc00b003a31fd05e0fsm3393682wmq.2.2022.08.18.23.57.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Aug 2022 23:57:40 -0700 (PDT) Message-Id: <3b4ed8bb1bb615277ee51a7b2af5fc53bae0a6e4.1660892256.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 19 Aug 2022 06:57:36 +0000 Subject: [PATCH 3/3] t4301: add a test case involving a rename, type change & modification Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin This is a reduced version of a real-world scenario that triggered the work on the original file names. Let's make sure that Git does not regress in that scenario. Signed-off-by: Johannes Schindelin --- t/t4301-merge-tree-write-tree.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/t/t4301-merge-tree-write-tree.sh b/t/t4301-merge-tree-write-tree.sh index e08452a8531..3c41ade0a47 100755 --- a/t/t4301-merge-tree-write-tree.sh +++ b/t/t4301-merge-tree-write-tree.sh @@ -137,6 +137,38 @@ test_expect_success 'test conflict notices and such' ' test_cmp expect actual ' +test_expect_success SYMLINKS 'original file names and type changes' ' + git switch --detach side1^ && + test_commit modified whatever && + + git switch --detach HEAD^ && + git mv whatever wherever && + ln -s wherever whatever && + git add whatever && + test_tick && + git commit -m symlink && + git tag symlink && + + test_expect_code 1 \ + git merge-tree -z modified symlink >out && + printf "\\n" >>out && + anonymize_hash out >actual && + + q_to_tab <<-\EOF | lf_to_nul >expect && + HASH + 120000 HASH 3Qwhatever + 100644 HASH 1Qwhatever + 100644 HASH 2Qwhatever + + EOF + + q_to_nul <<-EOF >>expect && + 2QwhateverQwhatever~modifiedQCONFLICT (distinct modes)QCONFLICT (distinct types): whatever had different types on each side; renamed one of them so each can be recorded somewhere. + Q + EOF + test_cmp expect actual +' + for opt in $(git merge-tree --git-completion-helper-all) do if test $opt = "--trivial-merge" || test $opt = "--write-tree"