- print $client git( 'commit', '-m', $message,
- ( -e "$hostname/$path" ? "$hostname/$path" : $hostname )
- );
- } elsif ( $command =~ m{(diff|status|log)} ) {
- $command .= ' --summary' if $command eq 'log';
- pull_changes $hostname if $command eq 'diff';
- print $client git($command,$hostname);
+ $message =~ s/'/\\'/g;
+ $user =~ s/\/$//;
+ print $client git( "commit -m '$message' --author '$user <$hostname>' $backup_path" );
+ } elsif ( $command =~ m{(diff|status|log|ch)} ) {
+ $command .= ' --stat' if $command eq 'log';
+ $command = 'log --patch-with-stat' if $command =~ m/^ch/;
+ pull_changes( $hostname ) if $command eq 'diff';
+ if ( $on_host ) {
+ system 'rsync', '-avv', "root\@$on_host:$path", "$on_host/$path";
+ open(my $diff, '-|', "diff -Nuw $hostname$path $on_host$path");
+ while(<$diff>) {
+ print $client $_;
+ }
+ } else {
+ # commands without path will show host-wide status/changes
+ print $client git($command, $rel_path ? $backup_path : $hostname);
+ }