Skip to content

Commit 613c955

Browse files
committed
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 c531eab commit 613c955

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"
@@ -541,7 +542,7 @@ static int do_apply_stash(const char *prefix, struct stash_info *info,
541542
bases[0] = &info->b_tree;
542543

543544
ret = merge_recursive_generic(&o, &c_tree, &info->w_tree, 1, bases,
544-
merge_recursive, &result);
545+
merge_ort_recursive, &result);
545546
if (ret) {
546547
rerere(0);
547548

t/t1092-sparse-checkout-compatibility.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,12 +1163,15 @@ test_expect_success 'sparse-index is not expanded' '
11631163
ensure_not_expanded stash &&
11641164
ensure_not_expanded stash list &&
11651165
ensure_not_expanded stash show stash@{0} &&
1166+
ensure_not_expanded stash apply stash@{0} &&
11661167
ensure_not_expanded stash drop stash@{0} &&
11671168
11681169
ensure_not_expanded stash create &&
11691170
oid=$(git -C sparse-index stash create) &&
11701171
ensure_not_expanded stash store -m "test" $oid &&
11711172
ensure_not_expanded reset --hard &&
1173+
ensure_not_expanded stash pop &&
1174+
11721175
ensure_not_expanded checkout-index -f a &&
11731176
ensure_not_expanded checkout-index -f --all &&
11741177
for ref in update-deep update-folder1 update-folder2 update-deep

0 commit comments

Comments
 (0)