use App::Rgit::Repository;
use App::Rgit::Utils qw/validate :levels/;
+use constant IS_WIN32 => $^O eq 'MSWin32';
+
=head1 NAME
App::Rgit::Config - Base class for App::Rgit configurations.
sub new {
my ($class, %args) = &validate;
+
my $root = $args{root};
return unless defined $root and -d $root;
$root = abs_path $root unless file_name_is_absolute $root;
- return unless defined $args{git} and -x $args{git};
+
+ my $git = $args{git};
+ return unless defined $git;
+ if (IS_WIN32) {
+ unless (-x $git) {
+ $git .= '.bat';
+ return unless -x $git;
+ }
+ } else {
+ return unless -x $git;
+ }
+
my $conf = 'App::Rgit::Config::Default';
eval "require $conf; 1" or croak "Couldn't load $conf: $@";
+
my $r = App::Rgit::Repository->new(fake => 1);
return unless defined $r;
+
$conf->SUPER::new(
root => $root,
- git => $args{git},
+ git => $git,
cwd_repo => $r,
debug => defined $args{debug} ? int $args{debug} : WARN,
);