Skip to content

Commit

Permalink
Git - remove the ignore sources setting as it is now merged into the …
Browse files Browse the repository at this point in the history
…sources setting
  • Loading branch information
lszomoru committed Feb 13, 2025
1 parent 5764ecb commit 3732b7a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 15 deletions.
12 changes: 2 additions & 10 deletions extensions/git/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3312,7 +3312,8 @@
"error",
"warning",
"information",
"hint"
"hint",
"none"
]
},
"default": {
Expand All @@ -3321,15 +3322,6 @@
"markdownDescription": "%config.diagnosticsCommitHook.Sources%",
"scope": "resource"
},
"git.diagnosticsCommitHook.IgnoredSources": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"markdownDescription": "%config.diagnosticsCommitHook.IgnoredSources%",
"scope": "resource"
},
"git.untrackedChangesSoftDelete": {
"type": "boolean",
"default": true,
Expand Down
3 changes: 1 addition & 2 deletions extensions/git/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,7 @@
"config.blameStatusBarItem.template": "Template for the blame information status bar item. Supported variables:\n\n* `hash`: Commit hash\n\n* `hashShort`: First N characters of the commit hash according to `#git.commitShortHashLength#`\n\n* `subject`: First line of the commit message\n\n* `authorName`: Author name\n\n* `authorEmail`: Author email\n\n* `authorDate`: Author date\n\n* `authorDateAgo`: Time difference between now and the author date\n\n",
"config.commitShortHashLength": "Controls the length of the commit short hash.",
"config.diagnosticsCommitHook.Enabled": "Controls whether to check for unresolved diagnostics before committing.",
"config.diagnosticsCommitHook.IgnoredSources": "List of sources that should be ignored. **Note:** Ignored sources take precedence over the sources listed in `#git.diagnosticsCommitHook.Sources#`.",
"config.diagnosticsCommitHook.Sources": "Controls the list of sources (**Item**) and the minimum severity (**Value**) to be considered before committing.",
"config.diagnosticsCommitHook.Sources": "Controls the list of sources (**Item**) and the minimum severity (**Value**) to be considered before committing. **Note:** To ignore diagnostics from a particular source, add the source to the list and set the minimum severity to `none`.",
"config.untrackedChangesSoftDelete": "Controls whether discarding untracked changes moves the file(s) to the Recycle Bin (Windows), Trash (macOS, Linux) instead of deleting them.",
"submenu.explorer": "Git",
"submenu.commit": "Commit",
Expand Down
3 changes: 1 addition & 2 deletions extensions/git/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,6 @@ class CommandErrorOutputTextDocumentContentProvider implements TextDocumentConte
async function evaluateDiagnosticsCommitHook(repository: Repository, options: CommitOptions): Promise<boolean> {
const config = workspace.getConfiguration('git', Uri.file(repository.root));
const enabled = config.get<boolean>('diagnosticsCommitHook.Enabled', false) === true;
const ignoredSources = config.get<string[]>('diagnosticsCommitHook.IgnoredSources', []);
const sourceSeverity = config.get<Record<string, DiagnosticSeverityConfig>>('diagnosticsCommitHook.Sources', { '*': 'error' });

if (!enabled) {
Expand Down Expand Up @@ -652,7 +651,7 @@ async function evaluateDiagnosticsCommitHook(repository: Repository, options: Co
// Diagnostics
return diags.find(d => {
// No source or ignored source
if (!d.source || ignoredSources.includes(d.source)) {
if (!d.source || (Object.keys(sourceSeverity).includes(d.source) && sourceSeverity[d.source] === 'none')) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion extensions/git/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ export function getCommitShortHash(scope: Uri, hash: string): string {
return hash.substring(0, shortHashLength);
}

export type DiagnosticSeverityConfig = 'error' | 'warning' | 'information' | 'hint';
export type DiagnosticSeverityConfig = 'error' | 'warning' | 'information' | 'hint' | 'none';

export function toDiagnosticSeverity(value: DiagnosticSeverityConfig): DiagnosticSeverity {
return value === 'error'
Expand Down

0 comments on commit 3732b7a

Please sign in to comment.