Skip to content

Commit 20316da

Browse files
committed
stash: discard in-process cache after spawning index-changing processes
In 9a67cb4 (stash: convert push to builtin, 2018-12-20), we started to call `git apply -R --index` and `git reset --hard`, but held onto the now-stale index in memory. Let's discard it. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent a6567c7 commit 20316da

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

builtin/stash.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,6 +1333,7 @@ static int do_push_stash(struct pathspec ps, const char *stash_msg, int quiet,
13331333
goto done;
13341334
}
13351335
}
1336+
discard_cache();
13361337
if (ps.nr) {
13371338
struct child_process cp_add = CHILD_PROCESS_INIT;
13381339
struct child_process cp_diff = CHILD_PROCESS_INIT;
@@ -1428,6 +1429,8 @@ static int do_push_stash(struct pathspec ps, const char *stash_msg, int quiet,
14281429
if (keep_index < 1) {
14291430
struct child_process cp = CHILD_PROCESS_INIT;
14301431

1432+
discard_cache();
1433+
14311434
cp.git_cmd = 1;
14321435
argv_array_pushl(&cp.args, "reset", "-q", "--", NULL);
14331436
add_pathspecs(&cp.args, ps);

0 commit comments

Comments
 (0)