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 derrickstolee committed Nov 15, 2021
1 parent 86948c9 commit 3de113d
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 @@ -1212,12 +1212,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 3de113d

Please sign in to comment.