|
|
@ -183,7 +183,7 @@ export class Git { |
|
|
|
ref = ''; |
|
|
|
} |
|
|
|
|
|
|
|
const suffix = Strings.truncate(Strings.sanitizeForFileSystem(Git.isSha(ref) ? Git.shortenSha(ref) : ref), 50, ''); |
|
|
|
const suffix = Strings.truncate(Strings.sanitizeForFileSystem(Git.isSha(ref) ? Git.shortenSha(ref)! : ref), 50, ''); |
|
|
|
const ext = path.extname(fileName); |
|
|
|
|
|
|
|
const tmp = await import('tmp'); |
|
|
@ -224,9 +224,11 @@ export class Git { |
|
|
|
return sha === undefined ? false : Git.uncommittedRegex.test(sha); |
|
|
|
} |
|
|
|
|
|
|
|
static shortenSha(sha: string) { |
|
|
|
if (Git.isStagedUncommitted(sha)) return 'index'; |
|
|
|
if (Git.isUncommitted(sha)) return ''; |
|
|
|
static shortenSha(sha: string, strings: { deleted?: string, stagedUncommitted?: string, uncommitted?: string } = {}) { |
|
|
|
strings = { uncommitted: '', stagedUncommitted: 'index', ...strings }; |
|
|
|
|
|
|
|
if (Git.isStagedUncommitted(sha)) return strings.stagedUncommitted; |
|
|
|
if (Git.isUncommitted(sha)) return strings.uncommitted; |
|
|
|
|
|
|
|
const index = sha.indexOf('^'); |
|
|
|
if (index > 6) { |
|
|
|