Skip to content

Commit

Permalink
#143 New setting git-graph.useMailmap enables the use of .mailmap fil…
Browse files Browse the repository at this point in the history
…es when displaying author & committer names and email addresses.
  • Loading branch information
mhutchie committed Jul 28, 2019
1 parent ee432cf commit a603b6e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,11 @@
],
"default": "colour",
"description": "Specifies the colour theme of the icon displayed on the Git Graph tab."
},
"git-graph.useMailmap": {
"type": "boolean",
"default": false,
"markdownDescription": "Respect [.mailmap](https://git-scm.com/docs/git-check-mailmap#_mapping_authors) files when displaying author & committer names and email addresses."
}
}
},
Expand Down
4 changes: 4 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ class Config {
return this.config.get('tabIconColourTheme', 'colour');
}

public useMailmap() {
return this.config.get('useMailmap', false);
}

public gitPath(): string | null {
return vscode.workspace.getConfiguration('git').get('path', null);
}
Expand Down
8 changes: 5 additions & 3 deletions src/dataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ export class DataSource {
}

public generateGitCommandFormats() {
let dateType = getConfig().dateType() === 'Author Date' ? '%at' : '%ct';
this.gitLogFormat = ['%H', '%P', '%an', '%ae', dateType, '%s'].join(GIT_LOG_SEPARATOR);
this.gitCommitDetailsFormat = ['%H', '%P', '%an', '%ae', dateType, '%cn'].join(GIT_LOG_SEPARATOR) + '%n%B';
const config = getConfig();
let dateType = config.dateType() === 'Author Date' ? '%at' : '%ct';
let useMailmap = config.useMailmap();
this.gitLogFormat = ['%H', '%P', useMailmap ? '%aN' : '%an', useMailmap ? '%aE' : '%ae', dateType, '%s'].join(GIT_LOG_SEPARATOR);
this.gitCommitDetailsFormat = ['%H', '%P', useMailmap ? '%aN' : '%an', useMailmap ? '%aE' : '%ae', dateType, useMailmap ? '%cN' : '%cn'].join(GIT_LOG_SEPARATOR) + '%n%B';
}

public dispose() {
Expand Down
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export async function activate(context: vscode.ExtensionContext) {
vscode.workspace.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('git-graph.showStatusBarItem')) {
statusBarItem.refresh();
} else if (e.affectsConfiguration('git-graph.dateType')) {
} else if (e.affectsConfiguration('git-graph.dateType') || e.affectsConfiguration('git-graph.useMailmap')) {
dataSource.generateGitCommandFormats();
} else if (e.affectsConfiguration('git-graph.maxDepthOfRepoSearch')) {
repoManager.maxDepthOfRepoSearchChanged();
Expand Down

0 comments on commit a603b6e

Please sign in to comment.