@@ -29,7 +29,13 @@ export class ContributorsGitSubProvider implements GitContributorsSubProvider {
2929 async getContributors (
3030 repoPath : string ,
3131 rev ?: string | undefined ,
32- options ?: { all ?: boolean ; merges ?: boolean | 'first-parent' ; stats ?: boolean } ,
32+ options ?: {
33+ all ?: boolean ;
34+ merges ?: boolean | 'first-parent' ;
35+ pathspec ?: string ;
36+ since ?: string ;
37+ stats ?: boolean ;
38+ } ,
3339 ) : Promise < GitContributor [ ] > {
3440 if ( repoPath == null ) return [ ] ;
3541
@@ -38,7 +44,13 @@ export class ContributorsGitSubProvider implements GitContributorsSubProvider {
3844 key += ':all' ;
3945 }
4046 if ( options ?. merges ) {
41- key += `:merges:${ options . merges } ` ;
47+ key += `:merges=${ options . merges } ` ;
48+ }
49+ if ( options ?. pathspec ) {
50+ key += `:pathspec=${ options . pathspec } ` ;
51+ }
52+ if ( options ?. since ) {
53+ key += `:since=${ options . since } ` ;
4254 }
4355 if ( options ?. stats ) {
4456 key += ':stats' ;
@@ -67,12 +79,24 @@ export class ContributorsGitSubProvider implements GitContributorsSubProvider {
6779 args . push ( '--all' , '--single-worktree' ) ;
6880 }
6981
82+ if ( options ?. since ) {
83+ args . push ( `--since="${ options . since } "` ) ;
84+ }
85+
86+ if ( rev && ! isUncommittedStaged ( rev ) ) {
87+ args . push ( rev ) ;
88+ }
89+
90+ if ( options ?. pathspec ) {
91+ args . push ( '--' , options . pathspec ) ;
92+ } else {
93+ args . push ( '--' ) ;
94+ }
95+
7096 const result = await this . git . exec (
7197 { cwd : repoPath , configs : gitLogDefaultConfigs } ,
7298 'log' ,
7399 ...args ,
74- rev && ! isUncommittedStaged ( rev ) ? rev : undefined ,
75- '--' ,
76100 ) ;
77101
78102 const contributors = new Map < string , GitContributor > ( ) ;
@@ -89,25 +113,43 @@ export class ContributorsGitSubProvider implements GitContributorsSubProvider {
89113 c . email ,
90114 isUserMatch ( currentUser , c . author , c . email ) ,
91115 1 ,
116+ [
117+ {
118+ sha : c . sha ,
119+ date : new Date ( timestamp ) ,
120+ message : c . message ,
121+ files : c . stats ?. files ,
122+ additions : c . stats ?. additions ,
123+ deletions : c . stats ?. deletions ,
124+ } ,
125+ ] ,
92126 new Date ( timestamp ) ,
93127 new Date ( timestamp ) ,
94128 c . stats
95- ? {
96- ...c . stats ,
97- contributionScore : calculateContributionScore ( c . stats , timestamp ) ,
98- }
129+ ? { ...c . stats , contributionScore : calculateContributionScore ( c . stats , timestamp ) }
99130 : undefined ,
100131 ) ;
101132 contributors . set ( key , contributor ) ;
102133 } else {
103- contributor . commits ++ ;
134+ contributor . contributionCount ++ ;
104135 const date = new Date ( timestamp ) ;
105136 if ( date > contributor . latestCommitDate ! ) {
106137 contributor . latestCommitDate = date ;
107138 }
108139 if ( date < contributor . firstCommitDate ! ) {
109140 contributor . firstCommitDate = date ;
110141 }
142+
143+ contributor . contributions ??= [ ] ;
144+ contributor . contributions . push ( {
145+ sha : c . sha ,
146+ date : new Date ( timestamp ) ,
147+ message : c . message ,
148+ files : c . stats ?. files ,
149+ additions : c . stats ?. additions ,
150+ deletions : c . stats ?. deletions ,
151+ } ) ;
152+
111153 if ( options ?. stats && c . stats != null ) {
112154 if ( contributor . stats == null ) {
113155 contributor . stats = {
0 commit comments