ソースを参照

Adds working tree string to shortenSha

main
Eric Amodio 6年前
コミット
e1f62a01cf
3個のファイルの変更7行の追加5行の削除
  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 ファイルの表示

@ -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 ファイルの表示

@ -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 ファイルの表示

@ -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;
}

読み込み中…
キャンセル
保存