Subject: | Command silently filters string overloaded objects such as Path::Class. |
use Path::Class;
use Git::Repository;
my $dir = dir("/tmp");
print Git::Repository->run( init => $dir ), "\n";
my $repo = Git::Repository->new( work_tree => $dir );
__END__
Reinitialized existing Git repository in /Users/schwern/src/Git-Repository/.git/
fatal: Not a git repository (or any of the parent directories): .git at - line 6.
use Git::Repository;
my $dir = dir("/tmp");
print Git::Repository->run( init => $dir ), "\n";
my $repo = Git::Repository->new( work_tree => $dir );
__END__
Reinitialized existing Git repository in /Users/schwern/src/Git-Repository/.git/
fatal: Not a git repository (or any of the parent directories): .git at - line 6.
Git::Repository::Command->new silently filters out all references from the list of commands. This means any string overloaded objects, such as Path::Class::Dir, will silently be thrown out. This makes using Path::Class with Git::Repository problematic and dangerous, without a work directory the git object might try to work in the current directory. I already had a project get a bogus commit because of this.
Possible solutions: remove the silent filter, make the filter throw an exception, make the filter check if the thing is an object and is string overloaded. Personally I'd just remove the filter.
Possible solutions: remove the silent filter, make the filter throw an exception, make the filter check if the thing is an object and is string overloaded. Personally I'd just remove the filter.