mirror of
https://github.com/git-for-windows/git.git
synced 2026-04-03 05:12:56 -05:00
Merge branch 'mr/merge-file-object-id-worktree-fix'
merge-file --object-id used to trigger a BUG when run in a linked worktree, which has been fixed. * mr/merge-file-object-id-worktree-fix: merge-file: fix BUG when --object-id is used in a worktree
This commit is contained in:
@@ -108,7 +108,8 @@ int cmd_merge_file(int argc,
|
||||
return error_errno("failed to redirect stderr to /dev/null");
|
||||
}
|
||||
|
||||
if (object_id)
|
||||
if (!repo && object_id)
|
||||
/* emit the correct "not a git repo" error in this case */
|
||||
setup_git_directory();
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
|
||||
@@ -542,6 +542,15 @@ test_expect_success '--object-id fails without repository' '
|
||||
grep "not a git repository" err
|
||||
'
|
||||
|
||||
test_expect_success 'run in a linked worktree with --object-id' '
|
||||
empty="$(test_oid empty_blob)" &&
|
||||
git worktree add work &&
|
||||
git -C work merge-file --object-id $empty $empty $empty >actual &&
|
||||
git worktree remove work &&
|
||||
git merge-file --object-id $empty $empty $empty >expected &&
|
||||
test_cmp actual expected
|
||||
'
|
||||
|
||||
test_expect_success 'merging C files with "myers" diff algorithm creates some spurious conflicts' '
|
||||
cat >expect.c <<-\EOF &&
|
||||
int g(size_t u)
|
||||
|
||||
Reference in New Issue
Block a user