Skip to content

Commit b535ff0

Browse files
vdyedscho
authored andcommitted
stash: use merge-ort rather than merge-recursive
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 <[email protected]>
1 parent 5867d55 commit b535ff0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

builtin/stash.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "cache-tree.h"
88
#include "unpack-trees.h"
99
#include "merge-recursive.h"
10+
#include "merge-ort-wrappers.h"
1011
#include "strvec.h"
1112
#include "run-command.h"
1213
#include "dir.h"
@@ -554,7 +555,7 @@ static int do_apply_stash(const char *prefix, struct stash_info *info,
554555
bases[0] = &info->b_tree;
555556

556557
ret = merge_recursive_generic(&o, &c_tree, &info->w_tree, 1, bases,
557-
merge_recursive, &result);
558+
merge_ort_recursive, &result);
558559
if (ret) {
559560
rerere(0);
560561

t/t1092-sparse-checkout-compatibility.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,12 +1262,15 @@ test_expect_success 'sparse-index is not expanded' '
12621262
ensure_not_expanded stash &&
12631263
ensure_not_expanded stash list &&
12641264
ensure_not_expanded stash show stash@{0} &&
1265+
ensure_not_expanded stash apply stash@{0} &&
12651266
ensure_not_expanded stash drop stash@{0} &&
12661267
12671268
ensure_not_expanded stash create &&
12681269
oid=$(git -C sparse-index stash create) &&
12691270
ensure_not_expanded stash store -m "test" $oid &&
12701271
ensure_not_expanded reset --hard &&
1272+
ensure_not_expanded stash pop &&
1273+
12711274
ensure_not_expanded checkout-index -f a &&
12721275
ensure_not_expanded checkout-index -f --all &&
12731276
for ref in update-deep update-folder1 update-folder2 update-deep

0 commit comments

Comments
 (0)