File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,8 @@ int cmd_merge_file(int argc,
108108 return error_errno ("failed to redirect stderr to /dev/null" );
109109 }
110110
111- if (object_id )
111+ if (!repo && object_id )
112+ /* emit the correct "not a git repo" error in this case */
112113 setup_git_directory ();
113114
114115 for (i = 0 ; i < 3 ; i ++ ) {
Original file line number Diff line number Diff line change @@ -542,6 +542,15 @@ test_expect_success '--object-id fails without repository' '
542542 grep "not a git repository" err
543543'
544544
545+ test_expect_success ' run in a linked worktree with --object-id' '
546+ empty="$(test_oid empty_blob)" &&
547+ git worktree add work &&
548+ git -C work merge-file --object-id $empty $empty $empty >actual &&
549+ git worktree remove work &&
550+ git merge-file --object-id $empty $empty $empty >expected &&
551+ test_cmp actual expected
552+ '
553+
545554test_expect_success ' merging C files with "myers" diff algorithm creates some spurious conflicts' '
546555 cat >expect.c <<-\EOF &&
547556 int g(size_t u)
You can’t perform that action at this time.
0 commit comments