@@ -643,16 +643,20 @@ function getFileModificationHistory(): array {
643
643
$ repos [$ ac ['LANG ' ]] = "{$ ac ['rootdir ' ]}/ {$ ac ['LANG ' ]}" ;
644
644
$ repos = array_unique ($ repos );
645
645
646
- foreach ($ repos as $ name => $ path )
646
+ $ output = "" ;
647
+ foreach ( $ repos as $ name => $ path )
647
648
{
648
- $ driveSwitch = is_windows () ? '/d ' : '' ;
649
- $ output = str_pad ( "$ name: " , 10 );
650
- $ output .= `cd $ driveSwitch $ path && git rev-parse HEAD `;
651
- $ output .= `cd $ driveSwitch $ path && git status -s `;
652
- $ output .= `cd $ driveSwitch $ path && git for-each-ref --format="%(push:track)" refs/heads `;
653
- echo trim ($ output ) . "\n" ;
654
- }
655
- echo "\n" ;
649
+ $ path = escapeshellarg ( $ path );
650
+ $ branch = trim ( `git -C $ path rev-parse --abbrev-ref HEAD ` );
651
+ $ branch = $ branch == "master " ? "" : " (branch $ branch) " ;
652
+ $ output .= str_pad ( "$ name: " , 10 );
653
+ $ output .= rtrim ( `git -C $ path rev-parse HEAD ` ?? "" ) . "$ branch \n" ;
654
+ $ output .= rtrim ( `git -C $ path status -s ` ?? "" ) . "\n" ;
655
+ $ output .= rtrim ( `git -C $ path for-each-ref --format="%(push:track)" refs/heads ` ?? "" ) . "\n" ;
656
+ }
657
+ while ( str_contains ( $ output , "\n\n" ) )
658
+ $ output = str_replace ( "\n\n" , "\n" , $ output );
659
+ echo "\n" , trim ( $ output ) . "\n\n" ;
656
660
657
661
foreach ($ infiles as $ in ) {
658
662
$ in = chop ("{$ ac ['basedir ' ]}/ {$ in }" );
0 commit comments