Re: [PATCH] merge-file: fix BUG when --object-id is used in a worktree
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Mar 10, 2026, 12:49 UTC
- Message-ID
- <abATPiRUczb8fe4t@pks.im>
- In-Reply-To
- <86e5c9f7-cd99-4c4f-a852-f3b1ada53722@app.fastmail.com>
On Tue, Mar 10, 2026 at 11:46:01AM +0000, Mathias Rav wrote:
Which commit is this patch based on? It doesn't apply in its current form on top of "master" since at least 8600b4ec9e (merge-file: honor merge.conflictStyle outside of a repository, 2026-02-07). Please rebase the patch.
Show 13 quoted lines
> diff --git a/builtin/merge-file.c b/builtin/merge-file.c
> index 46775d0c79..a8768c6e0c 100644
> --- a/builtin/merge-file.c
> +++ b/builtin/merge-file.c
> @@ -110,7 +110,7 @@ int cmd_merge_file(int argc,
> return error_errno("failed to redirect stderr to /dev/null");
> }
>
> - if (object_id)
> + if (object_id && !repo)
> setup_git_directory();
>
> for (i = 0; i < 3; i++) {Okay, makes sense. Makes me wonder whether we have other cases of the same error class.
Show 12 quoted lines
> diff --git a/t/t6403-merge-file.sh b/t/t6403-merge-file.sh > index 06ab4d7aed..60cc43775f 100755 > --- a/t/t6403-merge-file.sh > +++ b/t/t6403-merge-file.sh > @@ -506,6 +506,15 @@ test_expect_success '--object-id fails without repository' ' > grep "not a git repository" err > ' > > +test_expect_success 'run inside worktree with --object-id' ' > + empty="$(test_oid empty_blob)" && > + git worktree add work && > + (cd work && git merge-file --object-id $empty $empty $empty) >actual &&
This can be written without a subshell by saying `git -C work merge-file`.
Thanks!
Patrick