Skip to content

Commit 0311a59

Browse files
bekatanisomorphic-git-bot
authored andcommitted
fix: fixes #2138 stash push/pop issue with correct stash drop and adds regression test (#2150)
* test: add regression test for stash push/pop issue (#2138) * fix: ensure newline at end of reflog entries and correct last stash commit retrieval. fixes #2138 * fix: reverse order of stashes in list and update reflog writing logic
1 parent 5a70fe0 commit 0311a59

File tree

6 files changed

+14
-5
lines changed

6 files changed

+14
-5
lines changed

js/isomorphic-git/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
391391
<td align="center"><a href="https://github.com/ARBhosale"><img src="https://avatars.githubusercontent.com/u/26981417?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Aniket Bhosale</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=ARBhosale" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=ARBhosale" title="Documentation">📖</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=ARBhosale" title="Tests">⚠️</a></td>
392392
<td align="center"><a href="https://github.com/gnillev"><img src="https://avatars.githubusercontent.com/u/8965094?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Mathias Nisted Velling</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=gnillev" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=gnillev" title="Tests">⚠️</a></td>
393393
<td align="center"><a href="https://github.com/acandoo"><img src="https://avatars.githubusercontent.com/u/117209328?v=4?s=60" width="60px;" alt=""/><br /><sub><b>acandoo</b></sub></a><br /><a href="#platform-acandoo" title="Packaging/porting to new platform">📦</a> <a href="#userTesting-acandoo" title="User Testing">📓</a></td>
394+
<td align="center"><a href="https://github.com/bekatan"><img src="https://avatars.githubusercontent.com/u/19550476?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Bekatan Satyev</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=bekatan" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=bekatan" title="Tests">⚠️</a></td>
394395
<td align="center"><a href="https://github.com/hemanthkini"><img src="https://avatars.githubusercontent.com/u/3934055?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Hemanth Kini</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=hemanthkini" title="Code">💻</a></td>
395396
</tr>
396397
</table>

js/isomorphic-git/index.cjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15179,7 +15179,11 @@ async function _stashDrop({ fs, dir, gitdir, refIdx = 0 }) {
1517915179
const stashReflogPath = stashMgr.refLogsStashPath;
1518015180
await acquireLock$1({ reflogEntries, stashReflogPath, stashMgr }, async () => {
1518115181
if (reflogEntries.length) {
15182-
await fs.write(stashReflogPath, reflogEntries.join('\n'), 'utf8');
15182+
await fs.write(
15183+
stashReflogPath,
15184+
reflogEntries.reverse().join('\n') + '\n',
15185+
'utf8'
15186+
);
1518315187
const lastStashCommit = reflogEntries[reflogEntries.length - 1].split(
1518415188
' '
1518515189
)[1];

js/isomorphic-git/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15173,7 +15173,11 @@ async function _stashDrop({ fs, dir, gitdir, refIdx = 0 }) {
1517315173
const stashReflogPath = stashMgr.refLogsStashPath;
1517415174
await acquireLock$1({ reflogEntries, stashReflogPath, stashMgr }, async () => {
1517515175
if (reflogEntries.length) {
15176-
await fs.write(stashReflogPath, reflogEntries.join('\n'), 'utf8');
15176+
await fs.write(
15177+
stashReflogPath,
15178+
reflogEntries.reverse().join('\n') + '\n',
15179+
'utf8'
15180+
);
1517715181
const lastStashCommit = reflogEntries[reflogEntries.length - 1].split(
1517815182
' '
1517915183
)[1];

js/isomorphic-git/index.umd.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/isomorphic-git/index.umd.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/isomorphic-git/size_report.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)