Skip to content

Commit 93f2be5

Browse files
committed
Fixes issue showing changes with untracked stashed files
1 parent c3d7824 commit 93f2be5

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
77
## [Unreleased]
88
### Fixed
99
- Fixes [#454](https://github.com/eamodio/vscode-gitlens/issues/454) - Search for string returns merge commits (unlike raw `git log -S`)
10+
- Fixes issue showing changes with untracked stashed files
1011

1112
## [8.5.2] - 2018-07-20
1213
### Fixed

src/git/models/logCommit.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,18 @@ export class GitLogCommit extends GitCommit {
9595
status = fileNameOrStatus;
9696
}
9797

98+
let sha;
99+
// If this is a stash commit with an untracked file
100+
if (this.type === GitCommitType.Stash && status.status === '?') {
101+
sha = `${this.sha}^3`;
102+
}
103+
98104
// If this isn't a single-file commit, we can't trust the previousSha
99105
const previousSha = this.isFile ? this.previousSha : `${this.sha}^`;
100106

101107
return this.with({
102108
type: this.isStash ? GitCommitType.StashFile : GitCommitType.File,
109+
sha: sha,
103110
fileName: status.fileName,
104111
originalFileName: status.originalFileName,
105112
previousSha: previousSha,

src/gitService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1770,7 +1770,7 @@ export class GitService extends Disposable {
17701770
}
17711771

17721772
async resolveReference(repoPath: string, ref: string, uri?: Uri) {
1773-
if (!GitService.isResolveRequired(ref)) return ref;
1773+
if (!GitService.isResolveRequired(ref) || ref.endsWith('^3')) return ref;
17741774

17751775
Logger.log(`resolveReference('${repoPath}', '${ref}', '${uri && uri.toString()}')`);
17761776

0 commit comments

Comments
 (0)