Selaa lähdekoodia

Adds working tree string to shortenSha

main
Eric Amodio 6 vuotta sitten
vanhempi
commit
e1f62a01cf
3 muutettua tiedostoa jossa 7 lisäystä ja 5 poistoa
  1. +3
    -2
      src/git/git.ts
  2. +3
    -2
      src/gitService.ts
  3. +1
    -1
      src/views/comparisonResultsNode.ts

+ 3
- 2
src/git/git.ts Näytä tiedosto

@ -225,9 +225,10 @@ export class Git {
return sha === undefined ? false : Git.uncommittedRegex.test(sha);
}
static shortenSha(sha: string, strings: { deleted?: string, stagedUncommitted?: string, uncommitted?: string } = {}) {
strings = { uncommitted: '', stagedUncommitted: 'index', ...strings };
static shortenSha(sha: string, strings: { stagedUncommitted?: string, uncommitted?: string, working?: string } = {}) {
strings = { stagedUncommitted: 'index', uncommitted: '', working: '', ...strings };
if (sha === '') return strings.working;
if (Git.isStagedUncommitted(sha)) return strings.stagedUncommitted;
if (Git.isUncommitted(sha)) return strings.uncommitted;

+ 3
- 2
src/gitService.ts Näytä tiedosto

@ -1454,11 +1454,12 @@ export class GitService extends Disposable {
return Git.isUncommitted(sha);
}
static shortenSha(sha: string | undefined, strings: { deleted?: string, stagedUncommitted?: string, uncommitted?: string } = {}) {
static shortenSha(sha: string | undefined, strings: { deleted?: string, stagedUncommitted?: string, uncommitted?: string, working?: string } = {}) {
if (sha === undefined) return undefined;
strings = { deleted: '(deleted)', ...strings };
strings = { deleted: '(deleted)', working: '', ...strings };
if (sha === '') return strings.working;
if (sha === GitService.deletedSha) return strings.deleted;
return Git.isSha(sha) || Git.isStagedUncommitted(sha)

+ 1
- 1
src/views/comparisonResultsNode.ts Näytä tiedosto

@ -54,7 +54,7 @@ export class ComparisonResultsNode extends ExplorerNode {
repository = ` ${Strings.pad(GlyphChars.Dash, 1, 1)} ${(repo && repo.formattedName) || this.uri.repoPath}`;
}
const item = new TreeItem(`Comparing ${GitService.shortenSha(this.ref1)} to ${this.ref2 !== '' ? GitService.shortenSha(this.ref2) : 'Working Tree'}${repository}`, TreeItemCollapsibleState.Expanded);
const item = new TreeItem(`Comparing ${GitService.shortenSha(this.ref1, { working: 'Working Tree' })} to ${GitService.shortenSha(this.ref2, { working: 'Working Tree' })}${repository}`, TreeItemCollapsibleState.Expanded);
item.contextValue = ResourceType.ComparisonResults;
return item;
}

Ladataan…
Peruuta
Tallenna