@@ -215,6 +215,7 @@ impl Info {
215
215
let workdir = git_utils:: get_repo_work_dir ( & repo) ?;
216
216
let ( repository_name, repository_url) = git_utils:: get_repo_name_and_url ( & repo) ?;
217
217
let current_commit_info = git_utils:: get_current_commit_info ( & repo) ;
218
+ let pending = git_utils:: get_pending_changes ( & repo) ;
218
219
let git_history = Info :: get_git_history ( & workdir, config. no_merges ) ;
219
220
let creation_date = Info :: get_creation_date ( & git_history) ;
220
221
let number_of_commits = Info :: get_number_of_commits ( & git_history) ;
@@ -223,7 +224,6 @@ impl Info {
223
224
let ( number_of_tags, number_of_branches) = Info :: get_number_of_tags_branches ( & workdir) ;
224
225
let ( git_v, git_user) = Info :: get_git_version_and_username ( & workdir) ;
225
226
let version = Info :: get_version ( & workdir) ;
226
- let pending = Info :: get_pending_changes ( & workdir) ;
227
227
let repo_size = Info :: get_packed_size ( & workdir) ;
228
228
let project_license = Detector :: new ( ) ?. get_project_license ( & workdir) ;
229
229
let dependencies = deps:: DependencyDetector :: new ( ) . get_dependencies ( & workdir) ?;
@@ -381,54 +381,6 @@ impl Info {
381
381
number_of_commits. to_string ( )
382
382
}
383
383
384
- fn get_pending_changes ( dir : & str ) -> Result < String > {
385
- let output = Command :: new ( "git" )
386
- . arg ( "-C" )
387
- . arg ( dir)
388
- . arg ( "status" )
389
- . arg ( "--porcelain" )
390
- . output ( )
391
- . expect ( "Failed to execute git." ) ;
392
-
393
- let output = String :: from_utf8_lossy ( & output. stdout ) ;
394
-
395
- if output == "" {
396
- Ok ( "" . into ( ) )
397
- } else {
398
- let lines = output. lines ( ) ;
399
-
400
- let mut deleted = 0 ;
401
- let mut added = 0 ;
402
- let mut modified = 0 ;
403
-
404
- for line in lines {
405
- let prefix = & line[ ..2 ] ;
406
-
407
- match prefix. trim ( ) {
408
- "D" => deleted += 1 ,
409
- "A" | "AM" | "??" => added += 1 ,
410
- "M" | "MM" | "R" => modified += 1 ,
411
- _ => { }
412
- }
413
- }
414
-
415
- let mut result = String :: from ( "" ) ;
416
- if modified > 0 {
417
- result = format ! ( "{}+-" , modified)
418
- }
419
-
420
- if added > 0 {
421
- result = format ! ( "{} {}+" , result, added) ;
422
- }
423
-
424
- if deleted > 0 {
425
- result = format ! ( "{} {}-" , result, deleted) ;
426
- }
427
-
428
- Ok ( result. trim ( ) . into ( ) )
429
- }
430
- }
431
-
432
384
fn get_packed_size ( dir : & str ) -> Result < String > {
433
385
let output = Command :: new ( "git" )
434
386
. arg ( "-C" )
0 commit comments