summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan "Duke" Leto <jonathan@leto.net>2011-02-22 19:13:58 +0000
committerJonathan "Duke" Leto <jonathan@leto.net>2011-02-22 19:13:58 +0000
commitf92fcb669859ae4a00ef0ba9827f889d80c5197b (patch)
tree129c18027ebd553f4161b6dd7f2f098582f90f03
parentWe really only need to fetch new commits, not pull or rebase them. rbuels++ (diff)
downloadjitterbug-f92fcb669859ae4a00ef0ba9827f889d80c5197b.tar.gz
Create a new repo for the first time, even if reuse_repo is true
Diffstat (limited to '')
-rw-r--r--lib/jitterbug/Builder.pm27
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/jitterbug/Builder.pm b/lib/jitterbug/Builder.pm
index dfb3f99..1e71e2e 100644
--- a/lib/jitterbug/Builder.pm
+++ b/lib/jitterbug/Builder.pm
@@ -103,23 +103,28 @@ sub run_task {
$conf->{'jitterbug'}{'build'}{'dir'},
$task->project->name,
);
- my ($r, $repo);
+ my $r;
+ my $repo = $task->project->url . '.git';
unless ($buildconf->{reuse_repo}) {
debug("Removing $build_dir");
rmtree($build_dir, { error => \my $err } );
warn @$err if @$err;
- $repo = $task->project->url . '.git';
$r = Git::Repository->create( clone => $repo => $build_dir );
} else {
- my $pwd = getcwd;
- chdir $build_dir;
- # TODO: Error Checking
- debug("Cleaning git repo");
- system("git clean -dfx");
- debug("Fetching new commits into $repo");
- system("git fetch");
- chdir $pwd;
- $r = Git::Repository->new( work_tree => $build_dir );
+ # If this is the first time, the repo won't exist yet
+ if( -e $build_dir ){
+ my $pwd = getcwd;
+ chdir $build_dir;
+ # TODO: Error Checking
+ debug("Cleaning git repo");
+ system("git clean -dfx");
+ debug("Fetching new commits into $repo");
+ system("git fetch");
+ chdir $pwd;
+ $r = Git::Repository->new( work_tree => $build_dir );
+ } else {
+ $r = Git::Repository->create( clone => $repo => $build_dir );
+ }
}
$self->sleep(1); # avoid race conditions