Skip to content

Commit 54c226c

Browse files
committed
Fixes #320 - stash parser now handles single untracked files
1 parent 62a7eaf commit 54c226c

File tree

2 files changed

+27
-26
lines changed

2 files changed

+27
-26
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
1212
- Marks temporary files (used when showing comparisions with previous revisions) as read-only to help avoid accidental edits/saving
1313

1414
### Fixed
15+
- Fixes [#320](https://github.com/eamodio/vscode-gitlens/issues/320) - Stashes with a single untracked file created with "stash push" aren't shown in the GitLens explorer
1516
- Fixes [#331](https://github.com/eamodio/vscode-gitlens/issues/331) - Code lens shows on every import in Python
1617
- Fixes issues where quick pick menu progress indicators will get stuck in some cases because of a vscode api change in [Microsoft/vscode#46102](https://github.com/Microsoft/vscode/pull/46102)
1718

src/git/parsers/stashParser.ts

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -84,35 +84,35 @@ export class GitStashParser {
8484
case 102: // 'f': // files
8585
// Skip the blank line git adds before the files
8686
next = lines.next();
87-
if (next.done || next.value === '</f>') break;
88-
89-
while (true) {
90-
next = lines.next();
91-
if (next.done) break;
92-
93-
line = next.value;
94-
if (line === '</f>') break;
95-
96-
if (line.startsWith('warning:')) continue;
97-
98-
const status = {
99-
status: line[0] as GitStatusFileStatus,
100-
fileName: line.substring(1),
101-
originalFileName: undefined
102-
} as IGitStatusFile;
103-
GitLogParser.parseFileName(status);
104-
105-
if (status.fileName) {
106-
if (entry.fileStatuses === undefined) {
107-
entry.fileStatuses = [];
87+
if (!next.done && next.value !== '</f>') {
88+
while (true) {
89+
next = lines.next();
90+
if (next.done) break;
91+
92+
line = next.value;
93+
if (line === '</f>') break;
94+
95+
if (line.startsWith('warning:')) continue;
96+
97+
const status = {
98+
status: line[0] as GitStatusFileStatus,
99+
fileName: line.substring(1),
100+
originalFileName: undefined
101+
} as IGitStatusFile;
102+
GitLogParser.parseFileName(status);
103+
104+
if (status.fileName) {
105+
if (entry.fileStatuses === undefined) {
106+
entry.fileStatuses = [];
107+
}
108+
entry.fileStatuses.push(status);
108109
}
109-
entry.fileStatuses.push(status);
110110
}
111-
}
112111

113-
if (entry.fileStatuses !== undefined) {
114-
entry.fileNames = Arrays.filterMap(entry.fileStatuses,
115-
f => !!f.fileName ? f.fileName : undefined).join(', ');
112+
if (entry.fileStatuses !== undefined) {
113+
entry.fileNames = Arrays.filterMap(entry.fileStatuses,
114+
f => !!f.fileName ? f.fileName : undefined).join(', ');
115+
}
116116
}
117117

118118
let commit = commits.get(entry.ref!);

0 commit comments

Comments
 (0)