From: Vincent Pit Date: Sat, 27 Dec 2008 21:48:30 +0000 (+0100) Subject: Use @ as the escape character. ^ is actually an escape char of cmd.exe X-Git-Tag: v0.06~5 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Frgit.git;a=commitdiff_plain;h=cbafb1b35c3e76d6a7cf1628c83f08e64d3f3c5c Use @ as the escape character. ^ is actually an escape char of cmd.exe --- diff --git a/bin/rgit b/bin/rgit index 7124217..6e3e04f 100755 --- a/bin/rgit +++ b/bin/rgit @@ -149,39 +149,39 @@ Moreover, those formats are substituted in the arguments before running the comm =item * -C<^n> with the current repository name. +C<@n> with the current repository name. =item * -C<^g> with the relative path (based from the root directory) to the current repository. +C<@g> with the relative path (based from the root directory) to the current repository. =item * -C<^G> with the absolute path to the current repository. +C<@G> with the absolute path to the current repository. =item * -C<^w> with the relative path (based from the root directory) to the current repository's working directory. +C<@w> with the relative path (based from the root directory) to the current repository's working directory. =item * -C<^W> with the absolute path to the current repository's working directory. +C<@W> with the absolute path to the current repository's working directory. =item * -C<^b> with a "bareified" relative path, i.e. C<^g> if this is a bare repository, and C<^w.git> otherwise. +C<@b> with a "bareified" relative path, i.e. C<@g> if this is a bare repository, and C<@w.git> otherwise. =item * -C<^B> with an absolute version of the "bareified" path. +C<@B> with an absolute version of the "bareified" path. =item * -C<^R> with the absolute path to the root directory. +C<@R> with the absolute path to the root directory. =item * -C<^^> with a bare C<^>. +C<@@> with a bare C<@>. =back @@ -235,11 +235,11 @@ Execute C on all the repositories below the current directory : Tag all the repositories with their name : - rgit tag ^n + rgit tag @n Add a remote to all repositories in "/foo/bar" to their bare counterpart in C on F : - GIT_DIR="/foo/bar" rgit remote add host git://host/qux/^b + GIT_DIR="/foo/bar" rgit remote add host git://host/qux/@b =head1 DEPENDENCIES diff --git a/lib/App/Rgit/Repository.pm b/lib/App/Rgit/Repository.pm index 2fa3837..f415a81 100644 --- a/lib/App/Rgit/Repository.pm +++ b/lib/App/Rgit/Repository.pm @@ -118,7 +118,7 @@ sub _abs2rel { } my %escapes = ( - '^' => sub { '^' }, + '@' => sub { '@' }, 'n' => sub { shift->name }, 'g' => sub { _abs2rel(shift->repo, shift->root) }, 'G' => sub { shift->repo }, @@ -140,7 +140,7 @@ 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"); diff --git a/t/20-each.t b/t/20-each.t index 23692aa..9332cb9 100644 --- a/t/20-each.t +++ b/t/20-each.t @@ -89,7 +89,7 @@ is(grep({ ref eq 'ARRAY' } @expected), 3, 'all of them are array references'); @$_, map({ catdir($tmpdir, $_) } @{$_}[1 .. 3]), $tmpdir, - '^n', '^x' + '@n', '@x' ], @expected; sub try { @@ -99,7 +99,7 @@ sub try { git => abs_path('t/bin/git'), root => $tmpdir, cmd => $cmd, - args => [ abs_path($filename), $cmd, qw/^n ^g ^w ^b ^G ^W ^B ^R ^^n ^x/ ], + args => [ abs_path($filename), $cmd, qw/@n @g @w @b @G @W @B @R @@n @x/ ], policy => $policy, ); isnt($ar, undef, "each $cmd has a defined object"); diff --git a/t/21-once.t b/t/21-once.t index 2a43ca9..5333be0 100644 --- a/t/21-once.t +++ b/t/21-once.t @@ -11,7 +11,7 @@ use Test::More tests => 9 * 5; use App::Rgit; my @expected = ( - ([ [ qw/^n ^g ^w ^b ^^/ ] ]) x 5 + ([ [ qw/@n @g @w @b @@/ ] ]) x 5 ); local $ENV{GIT_DIR} = 't'; @@ -23,7 +23,7 @@ for my $cmd (qw/daemon gui help init version/) { git => $ENV{GIT_EXEC_PATH}, root => $ENV{GIT_DIR}, cmd => $cmd, - args => [ abs_path($filename), $cmd, qw/^n ^g ^w ^b ^^/ ] + args => [ abs_path($filename), $cmd, qw/@n @g @w @b @@/ ] ); isnt($ar, undef, "once $cmd has a defined object"); my $exit = $ar->run; @@ -31,7 +31,7 @@ for my $cmd (qw/daemon gui help init version/) { my @lines = sort split /\n/, do { local $/; <$fh> }; is(@lines, 1, "once $cmd visited only one repo"); my $r = [ split /\|/, defined $lines[0] ? $lines[0] : '' ]; - my $e = [ $cmd, qw/^n ^g ^w ^b ^^/ ]; + my $e = [ $cmd, qw/@n @g @w @b @@/ ]; is($r->[$_], $e->[$_], "once $cmd argument $_ is ok") for 0 .. 5; }