@@ -40,6 +40,8 @@ import {
4040import {
4141 setGlobalConfigValue ,
4242 IConfigValueOrigin ,
43+ getOriginFilePath ,
44+ isConditionalInclude ,
4345 formatConfigScope ,
4446 formatConfigPath ,
4547} from '../../lib/git/config'
@@ -73,25 +75,26 @@ import {
7375} from '../../lib/feature-flag'
7476import { AriaLiveContainer } from '../accessibility/aria-live-container'
7577import { TooltippedContent } from '../lib/tooltipped-content'
78+ import { showItemInFolder } from '../main-process-proxy'
7679import { HookProgress } from '../../lib/git'
7780import { assertNever } from '../../lib/fatal-error'
7881
7982function renderScopeValue ( origin : IConfigValueOrigin ) : JSX . Element {
80- const scope = formatConfigScope ( origin )
81- if ( scope . includes ( 'includeIf' ) ) {
83+ if ( isConditionalInclude ( origin ) ) {
8284 return (
8385 < span >
8486 global, via < em > [includeIf]</ em >
8587 </ span >
8688 )
8789 }
88- return < span > { scope } </ span >
90+ return < span > { formatConfigScope ( origin ) } </ span >
8991}
9092
9193function formatConfigOriginTooltip (
9294 fieldName : string ,
9395 origin : IConfigValueOrigin ,
94- repositoryPath : string
96+ repositoryPath : string ,
97+ onRevealFile : ( ) => void
9598) : JSX . Element {
9699 return (
97100 < div className = "config-origin-tooltip" >
@@ -100,7 +103,9 @@ function formatConfigOriginTooltip(
100103 < span className = "config-origin-tooltip-label" > Scope:</ span >
101104 { renderScopeValue ( origin ) }
102105 < span className = "config-origin-tooltip-label" > File:</ span >
103- < span > { formatConfigPath ( origin , repositoryPath ) } </ span >
106+ < LinkButton onClick = { onRevealFile } >
107+ { formatConfigPath ( origin , repositoryPath ) }
108+ </ LinkButton >
104109 </ div >
105110 )
106111}
@@ -838,10 +843,20 @@ export class CommitMessage extends React.Component<
838843 const { commitAuthorNameOrigin, commitAuthorEmailOrigin } = this . props
839844 const repoPath = this . props . repository . path
840845 const nameTooltip = commitAuthorNameOrigin
841- ? formatConfigOriginTooltip ( 'Name' , commitAuthorNameOrigin , repoPath )
846+ ? formatConfigOriginTooltip (
847+ 'Name' ,
848+ commitAuthorNameOrigin ,
849+ repoPath ,
850+ this . onRevealNameConfigFile
851+ )
842852 : undefined
843853 const emailTooltip = commitAuthorEmailOrigin
844- ? formatConfigOriginTooltip ( 'Email' , commitAuthorEmailOrigin , repoPath )
854+ ? formatConfigOriginTooltip (
855+ 'Email' ,
856+ commitAuthorEmailOrigin ,
857+ repoPath ,
858+ this . onRevealEmailConfigFile
859+ )
845860 : undefined
846861
847862 return (
@@ -852,13 +867,15 @@ export class CommitMessage extends React.Component<
852867 className = "commit-author-name"
853868 tooltip = { nameTooltip }
854869 tooltipClassName = "config-origin"
870+ interactive = { true }
855871 >
856872 { commitAuthor . name }
857873 </ TooltippedContent >
858874 < TooltippedContent
859875 className = "commit-author-email"
860876 tooltip = { emailTooltip }
861877 tooltipClassName = "config-origin"
878+ interactive = { true }
862879 >
863880 { commitAuthor . email }
864881 </ TooltippedContent >
@@ -867,6 +884,24 @@ export class CommitMessage extends React.Component<
867884 )
868885 }
869886
887+ private onRevealNameConfigFile = ( ) => {
888+ const { commitAuthorNameOrigin } = this . props
889+ if ( commitAuthorNameOrigin ) {
890+ showItemInFolder (
891+ getOriginFilePath ( commitAuthorNameOrigin , this . props . repository . path )
892+ )
893+ }
894+ }
895+
896+ private onRevealEmailConfigFile = ( ) => {
897+ const { commitAuthorEmailOrigin } = this . props
898+ if ( commitAuthorEmailOrigin ) {
899+ showItemInFolder (
900+ getOriginFilePath ( commitAuthorEmailOrigin , this . props . repository . path )
901+ )
902+ }
903+ }
904+
870905 private onUpdateUserEmail = async ( email : string ) => {
871906 await setGlobalConfigValue ( 'user.email' , email )
872907 this . props . onRefreshAuthor ( )
0 commit comments