Skip to content

Commit d9d6253

Browse files
committed
Fix Git::create_new error when without reference
1 parent 0d1a996 commit d9d6253

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Git.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,13 @@ public static function &create_new($repo_path, $source = null, $remote_source =
148148
$repo = new self($repo_path, true, false);
149149
if (is_string($source)) {
150150
if ($remote_source) {
151-
if (!is_dir($reference) || !is_dir($reference.'/.git')) {
152-
throw new Exception('"'.$reference.'" is not a git repository. Cannot use as reference.');
153-
} else if (strlen($reference)) {
154-
$reference = realpath($reference);
155-
$reference = "--reference $reference";
151+
if (isset($reference)) {
152+
if (!is_dir($reference) || !is_dir($reference.'/.git')) {
153+
throw new Exception('"'.$reference.'" is not a git repository. Cannot use as reference.');
154+
} else if (strlen($reference)) {
155+
$reference = realpath($reference);
156+
$reference = "--reference $reference";
157+
}
156158
}
157159
$repo->clone_remote($source, $reference);
158160
} else {

0 commit comments

Comments
 (0)