diff options
author | Victoria Dye <vdye@github.com> | 2022-05-11 02:32:31 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-05-11 02:45:12 +0300 |
commit | 874cf2a6044462ddba7162730557354a107c3a6d (patch) | |
tree | 1cb2b91c060bc837cc9e9ffc6c49f627b539a931 /t/t1092-sparse-checkout-compatibility.sh | |
parent | 491df5f679f0381f529b967df25476ab944406ab (diff) |
stash: apply stash using 'merge_ort_nonrecursive()'
Update 'stash' to use 'merge_ort_nonrecursive()' to apply a stash to the
current working tree. When 'git stash apply' was converted from its shell
script implementation to a builtin in 8a0fc8d19d (stash: convert apply to
builtin, 2019-02-25), 'merge_recursive_generic()' was used to merge a stash
into the working tree as part of 'git stash (apply|pop)'. However, with the
single merge base used in 'do_apply_stash()', the commit wrapping done by
'merge_recursive_generic()' is not only unnecessary, but misleading (the
*real* merge base is labeled "constructed merge base"). Therefore, a
non-recursive merge of the working tree, stashed tree, and stash base tree
is more appropriate.
There are two options for a non-recursive merge-then-update-worktree
function: 'merge_trees()' and 'merge_ort_nonrecursive()'. Use
'merge_ort_nonrecursive()' to align with the default merge strategy used by
'git merge' (6a5fb96672 (Change default merge backend from recursive to ort,
2021-08-04)) and, because merge-ort does not operate in-place on the index,
avoid unnecessary index expansion. Update tests in 't1092' verifying index
expansion for 'git stash' accordingly.
Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1092-sparse-checkout-compatibility.sh')
-rwxr-xr-x | t/t1092-sparse-checkout-compatibility.sh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh index 85c6a56f1b..aaf4d880db 100755 --- a/t/t1092-sparse-checkout-compatibility.sh +++ b/t/t1092-sparse-checkout-compatibility.sh @@ -1385,7 +1385,7 @@ test_expect_success 'sparse-index is not expanded: stash' ' ensure_not_expanded stash && ensure_not_expanded stash list && ensure_not_expanded stash show stash@{0} && - ! ensure_not_expanded stash apply stash@{0} && + ensure_not_expanded stash apply stash@{0} && ensure_not_expanded stash drop stash@{0} && echo >>sparse-index/deep/new && @@ -1399,7 +1399,7 @@ test_expect_success 'sparse-index is not expanded: stash' ' oid=$(git -C sparse-index stash create) && ensure_not_expanded stash store -m "test" $oid && ensure_not_expanded reset --hard && - ! ensure_not_expanded stash pop + ensure_not_expanded stash pop ' test_expect_success 'sparse index is not expanded: diff' ' |