use warnings;
use Carp qw/croak/;
+use Config qw/%Config/;
use Cwd qw/cwd/;
use File::Spec::Functions qw/catfile path/;
use List::Util qw/first/;
+use App::Rgit::Utils qw/:codes/;
use App::Rgit;
-our $VERSION = '0.02';
+our $VERSION = '0.03';
+
+BEGIN {
+ if (-t && eval { use Term::ReadKey; 1 }) {
+ *policy = sub {
+ my ($cmd, $conf, $repo, $status, $signal) = @_;
+ return NEXT unless $status;
+ print STDERR "[a]bort, [i]gnore, [I]gnore all, [r]etry, open [s]hell ?";
+ ReadMode 4;
+ my $key = ReadKey 0;
+ ReadMode 1;
+ print STDERR "\n";
+ my %codes = (
+ 'a' => LAST,
+ 'i' => NEXT,
+ 'I' => NEXT | SAVE,
+ 'r' => REDO,
+ 's' => LAST,
+ );
+ $key = 'a' unless defined $key;
+ my $code = $codes{$key};
+ $code = $codes{a} unless defined $code;
+ return $code;
+ };
+ } else {
+ *policy = sub {
+ my ($cmd, $conf, $repo, $status, $signal) = @_;
+ return NEXT unless $status;
+ return LAST;
+ };
+ }
+}
+
+setpgrp 0, 0 if $Config{d_setpgrp};
my $cmd = first { !/^-/ } @ARGV;
$cmd = ' ' unless defined $cmd;
$root = cwd unless defined $root;
exit App::Rgit->new(
- git => $git,
- root => $root,
- cmd => $cmd,
- args => \@ARGV
+ git => $git,
+ root => $root,
+ cmd => $cmd,
+ args => \@ARGV,
+ policy => \&policy,
)->run;
__END__
=head1 VERSION
-Version 0.02
+Version 0.03
=head1 SYNOPSIS
=back
-There are actually a few commands that are only executed once in the current directory : C<version>, C<help>, C<daemon> and C<init>.
+There are actually a few commands that are only executed once in the current directory : C<daemon>, C<gui>, C<help>, C<init> and C<version>.
For any of those, no format substitution is done.
You can specify which C<git> executable to use with the C<GIT_EXEC_PATH> environment variable.
=head1 DEPENDENCIES
-The core modules L<Carp>, L<Cwd>, L<Exporter>, L<File::Find>, L<File::Spec::Functions> and L<List::Util>.
+The core modules L<Carp>, L<Cwd>, L<Exporter>, L<File::Find>, L<File::Spec::Functions>, L<List::Util> and L<POSIX>.
L<Object::Tiny>.