From: Felipe Contreras <felipe.contreras@gmail.com>
To: Derrick Stolee <derrickstolee@github.com>,
Felipe Contreras <felipe.contreras@gmail.com>,
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org
Cc: gitster@pobox.com, me@ttaylorr.com, christian.couder@gmail.com
Subject: Re: [PATCH] merge-tree: load default git config
Date: Thu, 11 May 2023 11:02:46 -0600 [thread overview]
Message-ID: <645d1fb69e9e8_26011a294a5@chronos.notmuch> (raw)
In-Reply-To: <015dcb79-9630-e188-65cf-23b005184db1@github.com>
Derrick Stolee wrote:
> On 5/10/2023 4:30 PM, Felipe Contreras wrote:
> > Derrick Stolee via GitGitGadget wrote:
> >> From: Derrick Stolee <derrickstolee@github.com>
> >>
> >> The 'git merge-tree' command handles creating root trees for merges
> >> without using the worktree. This is a critical operation in many Git
> >> hosts, as they typically store bare repositories.
> >>
> >> This builtin does not load the default Git config, which can have
> >> several important ramifications.
> >
> > For the record, I had already sent a better version of this patch almost 2
> > years ago [1], not just for `git merge-tree`, but other commands as well.
> >
> > The obvious fix was completely ignored by the maintainer.
> >
> > The reason why it should be git_xmerge_config and not git_default_config, is
> > that merge.conflictstyle would not be parsed if you call git_default_config.
>
> As mentioned by Elijah in a different thread, the merge machinery loads
> the merge config as needed. I confirmed by creating this test, which I
> may submit as an independent patch:
>
> test_expect_success 'merge-tree respects merge.conflictstyle' '
> test_commit conflict-base &&
> for branch in left right
> do
> git checkout -b $branch conflict-base &&
> echo $branch >>conflict-base.t &&
> git add conflict-base.t &&
> git commit -m $branch || return 1
> done &&
>
> test_must_fail git merge-tree left right >out1 &&
> test_must_fail git -c merge.conflictstyle=diff3 merge-tree left right >out2 &&
>
> tree1=$(head -n 1 out1) &&
> tree2=$(head -n 1 out2) &&
>
> git cat-file -p $tree1:conflict-base.t >conflict1 &&
> git cat-file -p $tree2:conflict-base.t >conflict2 &&
> ! test_cmp conflict1 conflict2 &&
> ! grep "||||||" conflict1 &&
> grep "||||||" conflict2
> '
This test is doing a real merge, not a trivial merge.
Try doing a trivial merge instead--which is what most of our testing framework
checks--and your test fails:
@@ -14,17 +14,12 @@ test_expect_success 'merge-tree respects merge.conflictstyle' '
git commit -m $branch || return 1
done &&
- test_must_fail git merge-tree left right >out1 &&
- test_must_fail git -c merge.conflictstyle=diff3 merge-tree left right >out2 &&
+ test_expect_code 0 git merge-tree conflict-base left right >out1 &&
+ test_expect_code 0 git -c merge.conflictstyle=diff3 merge-tree conflict-base left right >out2 &&
- tree1=$(head -n 1 out1) &&
- tree2=$(head -n 1 out2) &&
-
- git cat-file -p $tree1:conflict-base.t >conflict1 &&
- git cat-file -p $tree2:conflict-base.t >conflict2 &&
- ! test_cmp conflict1 conflict2 &&
- ! grep "||||||" conflict1 &&
- grep "||||||" conflict2
+ ! test_cmp out1 out2 &&
+ ! grep "||||||" out1 &&
+ grep "||||||" out2
'
--
Felipe Contreras
next prev parent reply other threads:[~2023-05-11 17:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-10 19:07 [PATCH] merge-tree: load default git config Derrick Stolee via GitGitGadget
2023-05-10 19:18 ` Junio C Hamano
2023-05-10 19:26 ` Derrick Stolee
2023-05-10 23:21 ` Taylor Blau
2023-05-11 6:39 ` Elijah Newren
2023-05-10 20:30 ` Felipe Contreras
2023-05-11 15:09 ` Derrick Stolee
2023-05-11 17:02 ` Felipe Contreras [this message]
2023-05-11 22:07 ` Felipe Contreras
2023-05-10 22:32 ` Junio C Hamano
2023-05-10 23:27 ` Felipe Contreras
2023-05-11 17:15 ` Felipe Contreras
2023-05-11 6:34 ` Elijah Newren
2023-05-11 7:45 ` Felipe Contreras
2023-05-11 15:00 ` Derrick Stolee
2023-05-11 21:56 ` [PATCH] merge-tree: load config correctly Felipe Contreras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=645d1fb69e9e8_26011a294a5@chronos.notmuch \
--to=felipe.contreras@gmail.com \
--cc=christian.couder@gmail.com \
--cc=derrickstolee@github.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=me@ttaylorr.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).