Skip to content

Commit 839131a

Browse files
committed
Fixes cache mutation on filtered stashes
1 parent 446f6cc commit 839131a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/env/node/git/localGitProvider.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5106,6 +5106,9 @@ export class LocalGitProvider implements GitProvider, Disposable {
51065106

51075107
// Return only reachable stashes from the given ref
51085108
if (options?.reachableFrom && gitStash?.stashes.size) {
5109+
// Create a copy because we are going to modify it and we don't want to mutate the cache
5110+
gitStash = { ...gitStash, stashes: new Map(gitStash.stashes) };
5111+
51095112
const oldestStashDate = new Date(min(gitStash.stashes.values(), c => c.date.getTime())).toISOString();
51105113

51115114
const ancestors = await this.git.rev_list(repoPath, options.reachableFrom, { since: oldestStashDate });

0 commit comments

Comments
 (0)