mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
Git - add git.commitShortHashLength setting (#237343)
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Event, Disposable, EventEmitter, SourceControlHistoryItemRef, l10n } from 'vscode';
|
||||
import { Event, Disposable, EventEmitter, SourceControlHistoryItemRef, l10n, workspace, Uri } from 'vscode';
|
||||
import { dirname, sep, relative } from 'path';
|
||||
import { Readable } from 'stream';
|
||||
import { promises as fs, createReadStream } from 'fs';
|
||||
@@ -766,3 +766,9 @@ export function fromNow(date: number | Date, appendAgoLabel?: boolean, useFullTi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getCommitShortHash(scope: Uri, hash: string): string {
|
||||
const config = workspace.getConfiguration('git', scope);
|
||||
const shortHashLength = config.get<number>('commitShortHashLength', 7);
|
||||
return hash.substring(0, shortHashLength);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user