mirror of
https://github.com/Microsoft/vscode
synced 2024-10-01 08:50:48 +00:00
Git - more cleanup of the history item labels (#216648)
* Git - 💄 history provider cleanup
* Git - more cleanup of the history item labels
This commit is contained in:
parent
f280d9980f
commit
eb4092a6de
|
@ -32,6 +32,12 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
|
|||
}
|
||||
|
||||
private historyItemDecorations = new Map<string, FileDecoration>();
|
||||
private historyItemLabels = new Map<string, string>([
|
||||
['HEAD -> refs/heads/', 'target'],
|
||||
['refs/heads/', 'git-branch'],
|
||||
['refs/remotes/', 'cloud'],
|
||||
['refs/tags/', 'tag']
|
||||
]);
|
||||
|
||||
private disposables: Disposable[] = [];
|
||||
|
||||
|
@ -262,35 +268,18 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
|
|||
const labels: SourceControlHistoryItemLabel[] = [];
|
||||
|
||||
for (const label of commit.refNames) {
|
||||
if (label.startsWith('HEAD -> ')) {
|
||||
labels.push(
|
||||
{
|
||||
title: label.substring(19),
|
||||
icon: new ThemeIcon('git-branch')
|
||||
}
|
||||
);
|
||||
if (!label.startsWith('HEAD -> ') && !refNames.includes(label)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!refNames.includes(label)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (label.startsWith('refs/tags/')) {
|
||||
labels.push({
|
||||
title: label.substring(10),
|
||||
icon: new ThemeIcon('tag')
|
||||
});
|
||||
} else if (label.startsWith('refs/remotes/')) {
|
||||
labels.push({
|
||||
title: label.substring(13),
|
||||
icon: new ThemeIcon('cloud')
|
||||
});
|
||||
} else {
|
||||
labels.push({
|
||||
title: label.substring(11),
|
||||
icon: new ThemeIcon('git-branch')
|
||||
});
|
||||
for (const [key, value] of this.historyItemLabels) {
|
||||
if (label.startsWith(key)) {
|
||||
labels.push({
|
||||
title: label.substring(key.length),
|
||||
icon: new ThemeIcon(value)
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue