@@ -3,6 +3,7 @@ use crate::help;
3
3
use crate :: signing:: ReportSignature ;
4
4
use crate :: submission:: submit_report;
5
5
use futures:: stream:: { FuturesUnordered , StreamExt } ;
6
+ use stackmuncher_lib:: contributor:: Contributor ;
6
7
use stackmuncher_lib:: report_brief:: TechOverview ;
7
8
use stackmuncher_lib:: { code_rules:: CodeRules , config:: Config , git, report:: Report , utils:: hash_str_sha1} ;
8
9
use std:: path:: Path ;
@@ -128,7 +129,10 @@ pub(crate) async fn run(config: AppConfig) -> Result<(), ()> {
128
129
129
130
// combine multiple contributor reports from different identities
130
131
debug ! ( "Combining {} contributor reports" , contributor_reports. len( ) ) ;
131
- if !contributor_reports. is_empty ( ) {
132
+ if contributor_reports. is_empty ( ) {
133
+ // there were no matching contributors
134
+ print_no_contributions_msg ( & config. lib_config . git_identities , contributors) ;
135
+ } else {
132
136
// seed the combined report from the 1st contributor report in the list of all contributor reports
133
137
let ( mut combined_report, contributor_git_id) = contributor_reports. pop ( ) . unwrap ( ) ;
134
138
combined_report. reset_combined_contributor_report ( contributor_git_id, & list_of_commits, & project_report) ;
@@ -233,3 +237,38 @@ fn print_combined_stats(report: &Report) {
233
237
let per_tech_stats = per_tech_stats. as_slice ( ) . join ( ", " ) ;
234
238
println ! ( " Summary (LoC/libs): {}" , per_tech_stats) ;
235
239
}
240
+
241
+ /// Prints a list of contributors and git identities to help find user git identities
242
+ fn print_no_contributions_msg ( git_identities : & Vec < String > , contributors : & Vec < Contributor > ) {
243
+ // is this repo empty?
244
+ if contributors. is_empty ( ) {
245
+ println ! ( " This repository has no commits with identifiable committers." ) ;
246
+ return ;
247
+ }
248
+
249
+ match git_identities. len ( ) {
250
+ 0 => {
251
+ println ! ( ) ;
252
+ println ! ( " No commits were selected for analysis." ) ;
253
+ println ! ( " Configure `user.email` Git setting or use `--email` CLI params to add committer emails." ) ;
254
+ println ! ( ) ;
255
+ }
256
+ 1 => {
257
+ println ! ( ) ;
258
+ println ! (
259
+ "Found no commits from {}. Did you make commits with a different email?" ,
260
+ git_identities[ 0 ]
261
+ ) ;
262
+ println ! ( " Run `git shortlog -s -e --all` to see all committer emails in this repo." ) ;
263
+ println ! ( " Add more of your committer emails with `stackmuncher config --emails \" [email protected] ,[email protected] \" " ) ;
264
+ println ! ( ) ;
265
+ }
266
+ _ => {
267
+ println ! ( ) ;
268
+ println ! ( " Found no commits from any of: {}." , git_identities. join( ", " ) ) ;
269
+ println ! ( " Run `git shortlog -s -e --all` to see all committer emails in this repo." ) ;
270
+ println ! ( " Add more of your committer emails with `stackmuncher config --emails \" [email protected] ,[email protected] \" " ) ;
271
+ println ! ( ) ;
272
+ }
273
+ }
274
+ }
0 commit comments