зеркало из https://github.com/microsoft/git.git
sparse-checkout: update files with a modify/delete conflict
When using the sparse-checkout feature, the file might not be on disk because the skip-worktree bit is on. Signed-off-by: Kevin Willford <kewillf@microsoft.com>
This commit is contained in:
Родитель
31ed9bcbe6
Коммит
56a24e4498
|
@ -1588,7 +1588,7 @@ static int handle_change_delete(struct merge_options *opt,
|
||||||
* path. We could call update_file_flags() with update_cache=0
|
* path. We could call update_file_flags() with update_cache=0
|
||||||
* and update_wd=0, but that's a no-op.
|
* and update_wd=0, but that's a no-op.
|
||||||
*/
|
*/
|
||||||
if (change_branch != opt->branch1 || alt_path)
|
if (change_branch != opt->branch1 || alt_path || !file_exists(update_path))
|
||||||
ret = update_file(opt, 0, changed, update_path);
|
ret = update_file(opt, 0, changed, update_path);
|
||||||
}
|
}
|
||||||
free(alt_path);
|
free(alt_path);
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
test_description='merge can handle sparse-checkout'
|
||||||
|
|
||||||
|
. ./test-lib.sh
|
||||||
|
|
||||||
|
# merges with conflicts
|
||||||
|
|
||||||
|
test_expect_success 'setup' '
|
||||||
|
git branch -M main &&
|
||||||
|
test_commit a &&
|
||||||
|
test_commit file &&
|
||||||
|
git checkout -b delete-file &&
|
||||||
|
git rm file.t &&
|
||||||
|
test_tick &&
|
||||||
|
git commit -m "remove file" &&
|
||||||
|
git checkout main &&
|
||||||
|
test_commit modify file.t changed
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'merge conflict deleted file and modified' '
|
||||||
|
echo "/a.t" >.git/info/sparse-checkout &&
|
||||||
|
test_config core.sparsecheckout true &&
|
||||||
|
git checkout -f &&
|
||||||
|
test_path_is_missing file.t &&
|
||||||
|
test_must_fail git merge delete-file &&
|
||||||
|
test_path_is_file file.t &&
|
||||||
|
test "changed" = "$(cat file.t)"
|
||||||
|
'
|
||||||
|
|
||||||
|
test_done
|
Загрузка…
Ссылка в новой задаче