mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-30 05:21:08 +01:00
Merge remote-tracking branch 'origin/master' into joao/git-fs-provider
This commit is contained in:
@@ -5,8 +5,6 @@
|
||||
|
||||
import * as jschardet from 'jschardet';
|
||||
|
||||
jschardet.Constants.MINIMUM_THRESHOLD = 0.2;
|
||||
|
||||
function detectEncodingByBOM(buffer: Buffer): string | null {
|
||||
if (!buffer || buffer.length < 2) {
|
||||
return null;
|
||||
|
||||
@@ -1813,10 +1813,18 @@ export class Repository {
|
||||
}
|
||||
|
||||
cleanupCommitEditMessage(message: string): string {
|
||||
//TODO: Support core.commentChar
|
||||
return message.replace(/^\s*#.*$\n?/gm, '').trim();
|
||||
}
|
||||
// If the message is a single line starting with whitespace followed by `#`, just allow it.
|
||||
if (/^\s*#[^\n]*$/.test(message)) {
|
||||
return message;
|
||||
}
|
||||
|
||||
// Else, remove all lines starting with whitespace followed by `#`.
|
||||
// TODO: Support core.commentChar
|
||||
return message.replace(/^(\s*#)(.*)$(\n?)/gm, (_, prefix, content, suffix) => {
|
||||
// https://github.com/microsoft/vscode/issues/84201#issuecomment-552834814
|
||||
return /^\d/.test(content) ? `${prefix}${content}${suffix}` : '';
|
||||
}).trim();
|
||||
}
|
||||
|
||||
async getMergeMessage(): Promise<string | undefined> {
|
||||
const mergeMsgPath = path.join(this.repositoryRoot, '.git', 'MERGE_MSG');
|
||||
|
||||
@@ -844,7 +844,15 @@ export class Repository implements Disposable {
|
||||
return mergeMessage;
|
||||
}
|
||||
|
||||
return await this.repository.getCommitTemplate();
|
||||
let template = await this.repository.getCommitTemplate();
|
||||
|
||||
const config = workspace.getConfiguration('git', Uri.file(this.root));
|
||||
|
||||
if (!config.get<boolean>('restoreCommitTemplateComments')) {
|
||||
template = this.cleanUpCommitEditMessage(template);
|
||||
}
|
||||
|
||||
return template;
|
||||
}
|
||||
|
||||
getConfigs(): Promise<{ key: string; value: string; }[]> {
|
||||
@@ -1278,7 +1286,7 @@ export class Repository implements Disposable {
|
||||
return await this.run(Operation.GetCommitTemplate, async () => this.repository.getCommitTemplate());
|
||||
}
|
||||
|
||||
async cleanUpCommitEditMessage(editMessage: string): Promise<string> {
|
||||
cleanUpCommitEditMessage(editMessage: string): string {
|
||||
return this.repository.cleanupCommitEditMessage(editMessage);
|
||||
}
|
||||
|
||||
|
||||
11
extensions/git/src/typings/jschardet.d.ts
vendored
11
extensions/git/src/typings/jschardet.d.ts
vendored
@@ -1,11 +0,0 @@
|
||||
declare module 'jschardet' {
|
||||
export interface IDetectedMap {
|
||||
encoding: string,
|
||||
confidence: number
|
||||
}
|
||||
export function detect(buffer: Buffer): IDetectedMap;
|
||||
|
||||
export const Constants: {
|
||||
MINIMUM_THRESHOLD: number,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user