Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
.build
blib
extlib
pm_to_blib
App-GitGot-*
Makefile
Makefile.old
MYMETA.*
!releases/*.tar.gz
24 changes: 12 additions & 12 deletions lib/App/GitGot/Command.pm
Original file line number Diff line number Diff line change
Expand Up @@ -333,28 +333,28 @@ sub _git_clone_or_callback {
my( $self , $entry , $callback ) = @_
or die "Need entry and callback";

my $msg = '';

my $msg = '';
my $path = $entry->path;

if ( !-d $path ) {
path($path)->mkpath;

try {
$entry->clone( $entry->repo , './' );
$msg .= $self->major_change('Checked out');
}
if ( -d "$path/.git" ) {
# repo already exists and is checked out, just call the callback
try {
$msg .= $callback->( $msg , $entry );
}
catch { $msg .= $self->error('ERROR') . "\n$_" };
}
elsif ( -d "$path/.git" ) {
else {
# if the directory exists and is non-empty, git will blow up, but that's
# okay. if the directory doesn't exist, git will handle creating it; it
# will also DTRT if the directory is empty and exists
try {
$msg .= $callback->($msg , $entry);
$entry->clone( $entry->repo , $path );
$msg .= $self->major_change('Checked out');
}
catch { $msg .= $self->error('ERROR') . "\n$_" };
}

return $msg;

}

sub _git_fetch {
Expand Down