Skip to content

Commit

Permalink
stash: use merge-ort rather than merge-recursive
Browse files Browse the repository at this point in the history
Because `merge_recursive` forces the index to always be expanded, switching to
`merge_ort_recursive` is needed to allow the index to remain sparse when
applying a stash.

Signed-off-by: Victoria Dye <vdye@github.com>
  • Loading branch information
vdye authored and dscho committed Feb 1, 2022
1 parent d981457 commit 7c23363
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion builtin/stash.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "cache-tree.h"
#include "unpack-trees.h"
#include "merge-recursive.h"
#include "merge-ort-wrappers.h"
#include "strvec.h"
#include "run-command.h"
#include "dir.h"
Expand Down Expand Up @@ -554,7 +555,7 @@ static int do_apply_stash(const char *prefix, struct stash_info *info,
bases[0] = &info->b_tree;

ret = merge_recursive_generic(&o, &c_tree, &info->w_tree, 1, bases,
merge_recursive, &result);
merge_ort_recursive, &result);
if (ret) {
rerere(0);

Expand Down
3 changes: 3 additions & 0 deletions t/t1092-sparse-checkout-compatibility.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1262,12 +1262,15 @@ test_expect_success 'sparse-index is not expanded' '
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 drop stash@{0} &&
ensure_not_expanded stash create &&
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 checkout-index -f a &&
ensure_not_expanded checkout-index -f --all &&
for ref in update-deep update-folder1 update-folder2 update-deep
Expand Down

0 comments on commit 7c23363

Please sign in to comment.