Pārlūkot izejas kodu

Fixes #2394 ensures uncommitted parent is HEAD

main
Eric Amodio pirms 1 gada
vecāks
revīzija
66d3c411b1
4 mainītis faili ar 14 papildinājumiem un 3 dzēšanām
  1. +1
    -0
      CHANGELOG.md
  2. +4
    -0
      src/git/gitProviderService.ts
  3. +5
    -3
      src/git/models/commit.ts
  4. +4
    -0
      src/git/models/reference.ts

+ 1
- 0
CHANGELOG.md Parādīt failu

@ -39,6 +39,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Fixed
- Fixes [#2394](https://github.com/gitkraken/vscode-gitlens/issues/2394) - Work in progress file diff compares working tree with working tree, instead of working tree with head
- Fixes [#2207](https://github.com/gitkraken/vscode-gitlens/issues/2207) - Error when trying to push individual commit
- Fixes [#2301](https://github.com/gitkraken/vscode-gitlens/issues/2301) - Create Worktree button doesn't work in certain cases
- Fixes [#2382](https://github.com/gitkraken/vscode-gitlens/issues/2382) - commits disappearing from commit details view when they shouldn't

+ 4
- 0
src/git/gitProviderService.ts Parādīt failu

@ -2303,6 +2303,10 @@ export class GitProviderService implements Disposable {
pathOrUri?: string | Uri,
options?: { timeout?: number },
) {
if (pathOrUri != null && GitRevision.isUncommittedParent(ref)) {
ref = 'HEAD';
}
if (
!ref ||
ref === GitRevision.deletedOrMissing ||

+ 5
- 3
src/git/models/commit.ts Parādīt failu

@ -173,9 +173,11 @@ export class GitCommit implements GitRevisionReference {
private _resolvedPreviousSha: string | undefined;
get unresolvedPreviousSha(): string {
return (
this._resolvedPreviousSha ?? (this.file != null ? this.file.previousSha : this.parents[0]) ?? `${this.sha}^`
);
const previousSha =
this._resolvedPreviousSha ??
(this.file != null ? this.file.previousSha : this.parents[0]) ??
`${this.sha}^`;
return GitRevision.isUncommittedParent(previousSha) ? 'HEAD' : previousSha;
}
private _etagFileSystem: number | undefined;

+ 4
- 0
src/git/models/reference.ts Parādīt failu

@ -47,6 +47,10 @@ export namespace GitRevision {
return ref === uncommitted || ref === uncommittedStaged || (!exact && isMatch(uncommittedRegex, ref));
}
export function isUncommittedParent(ref: string | undefined) {
return ref === `${uncommitted}^` || ref === `${uncommittedStaged}^`;
}
export function isUncommittedStaged(ref: string | undefined, exact: boolean = false): boolean {
return ref === uncommittedStaged || (!exact && isMatch(uncommittedStagedRegex, ref));
}

Notiek ielāde…
Atcelt
Saglabāt