Skip to content

Commit

Permalink
Fix Git::create_new error when without reference
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxiyu191 committed Jan 31, 2016
1 parent 0d1a996 commit d9d6253
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Git.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,13 @@ public static function &create_new($repo_path, $source = null, $remote_source =
$repo = new self($repo_path, true, false);
if (is_string($source)) {
if ($remote_source) {
if (!is_dir($reference) || !is_dir($reference.'/.git')) {
throw new Exception('"'.$reference.'" is not a git repository. Cannot use as reference.');
} else if (strlen($reference)) {
$reference = realpath($reference);
$reference = "--reference $reference";
if (isset($reference)) {
if (!is_dir($reference) || !is_dir($reference.'/.git')) {
throw new Exception('"'.$reference.'" is not a git repository. Cannot use as reference.');
} else if (strlen($reference)) {
$reference = realpath($reference);
$reference = "--reference $reference";
}
}
$repo->clone_remote($source, $reference);
} else {
Expand Down

0 comments on commit d9d6253

Please sign in to comment.