]> git.vpit.fr Git - perl/modules/rgit.git/blobdiff - lib/App/Rgit/Repository.pm
Use @ as the escape character. ^ is actually an escape char of cmd.exe
[perl/modules/rgit.git] / lib / App / Rgit / Repository.pm
index 9b3973487152be447ae9609a95531719b930d580..f415a81dcf7980f1aeae345823bb325ff54415ed 100644 (file)
@@ -7,6 +7,13 @@ use Cwd qw/cwd abs_path/;
 use File::Spec::Functions qw/catdir splitdir abs2rel file_name_is_absolute/;
 use POSIX qw/WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG SIGINT SIGQUIT/;
 
+BEGIN {
+ no warnings 'redefine';
+ *WIFEXITED   = sub { 1 }             unless eval { WIFEXITED(0);   1 };
+ *WEXITSTATUS = sub { shift() >> 8 }  unless eval { WEXITSTATUS(0); 1 };
+ *WIFSIGNALED = sub { shift() & 127 } unless eval { WIFSIGNALED(0); 1 };
+}
+
 use Object::Tiny qw/fake repo bare name work/;
 
 use App::Rgit::Utils qw/validate/;
@@ -111,7 +118,7 @@ sub _abs2rel {
 }
 
 my %escapes = (
- '^' => sub { '^' },
+ '@' => sub { '@' },
  'n' => sub { shift->name },
  'g' => sub { _abs2rel(shift->repo, shift->root) },
  'G' => sub { shift->repo },
@@ -133,12 +140,14 @@ sub run {
  return unless $conf->isa('App::Rgit::Config');
  my @args = @_;
  unless ($self->fake) {
-  s/\^($e)/$escapes{$1}->($self, $conf)/eg for @args;
+  s/@($e)/$escapes{$1}->($self, $conf)/eg for @args;
  }
+ unshift @args, $conf->git;
+ $conf->info('Executing "', join(' ', @args), '" into ', $self->work, "\n");
  {
   local $ENV{GIT_DIR} = $self->repo if exists $ENV{GIT_DIR};
   local $ENV{GIT_EXEC_PATH} = $conf->git if exists $ENV{GIT_EXEC_PATH};
-  system { $conf->git } $conf->git, @args;
+  system { $args[0] } @args;
  }
  if ($? == -1) {
   $conf->crit("Failed to execute git: $!\n");