Skip to content

Commit de315e3

Browse files
vdyederrickstolee
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 <vdye@github.com>
1 parent c3f3f16 commit de315e3

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

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
@@ -1212,12 +1212,15 @@ test_expect_success 'sparse-index is not expanded' '
12121212
ensure_not_expanded stash &&
12131213
ensure_not_expanded stash list &&
12141214
ensure_not_expanded stash show stash@{0} &&
1215+
ensure_not_expanded stash apply stash@{0} &&
12151216
ensure_not_expanded stash drop stash@{0} &&
12161217
12171218
ensure_not_expanded stash create &&
12181219
oid=$(git -C sparse-index stash create) &&
12191220
ensure_not_expanded stash store -m "test" $oid &&
12201221
ensure_not_expanded reset --hard &&
1222+
ensure_not_expanded stash pop &&
1223+
12211224
ensure_not_expanded checkout-index -f a &&
12221225
ensure_not_expanded checkout-index -f --all &&
12231226
for ref in update-deep update-folder1 update-folder2 update-deep

0 commit comments

Comments
 (0)