summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan "Duke" Leto <jonathan@leto.net>2011-05-23 19:31:04 -0700
committerJonathan "Duke" Leto <jonathan@leto.net>2011-05-23 19:31:04 -0700
commit6b15ad18f2297bd195a3878ce6170de53db20ce5 (patch)
treea4f226b4e61159786822766b3a5842ba705477e6
parentMake sure the cached repo dir exists and clone from the correct cached dir (diff)
downloadjitterbug-6b15ad18f2297bd195a3878ce6170de53db20ce5.tar.gz
Call git fetch from the correct directory
-rw-r--r--lib/jitterbug/Builder.pm13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/jitterbug/Builder.pm b/lib/jitterbug/Builder.pm
index 6f882b4..0eeab30 100644
--- a/lib/jitterbug/Builder.pm
+++ b/lib/jitterbug/Builder.pm
@@ -111,23 +111,24 @@ sub _prepare_git_repo {
debug("build_dir = $build_dir");
mkdir $cached_repo_dir unless -d $cached_repo_dir;
+ my $cached_repo = catfile($cached_repo_dir,$name) );
- unless ( -d catfile($cached_repo_dir,$name) ) {
+ unless ( -d $cached_repo ) {
# If this is the first time, the repo won't exist yet
# Clone it into our cached repo directory
- _clone_into($repo, catfile($cached_repo_dir, $name));
+ _clone_into($repo, $cached_repo);
}
my $pwd = getcwd;
- chdir $cached_repo_dir;
+ chdir $cached_repo;
# TODO: Error Checking
- debug("Fetching new commits into $cached_repo_dir");
+ debug("Fetching new commits into $cached_repo");
system("git fetch --prune");
- chdir $pwd;
- debug("Cloning from cached repo $cached_repo_dir/$name into $build_dir");
+ $self->sleep(1); # avoid race conditions
+ debug("Cloning from cached repo $cached_repo_dir/$name into $build_dir");
_clone_into(catdir($cached_repo_dir,$name), $build_dir);
chdir $build_dir;