Skip to content

Commit 9065355

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 c353ff5 commit 9065355

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
@@ -1307,12 +1307,15 @@ test_expect_success 'sparse-index is not expanded' '
13071307
ensure_not_expanded stash &&
13081308
ensure_not_expanded stash list &&
13091309
ensure_not_expanded stash show stash@{0} &&
1310+
ensure_not_expanded stash apply stash@{0} &&
13101311
ensure_not_expanded stash drop stash@{0} &&
13111312
13121313
ensure_not_expanded stash create &&
13131314
oid=$(git -C sparse-index stash create) &&
13141315
ensure_not_expanded stash store -m "test" $oid &&
13151316
ensure_not_expanded reset --hard &&
1317+
ensure_not_expanded stash pop &&
1318+
13161319
ensure_not_expanded checkout-index -f a &&
13171320
ensure_not_expanded checkout-index -f --all &&
13181321
for ref in update-deep update-folder1 update-folder2 update-deep

0 commit comments

Comments
 (0)