Skip to content

Commit ccbc201

Browse files
authored
Merge pull request kbjr#43 from wangxiyu191/patch-1
Fix Git::create_new error when without reference
2 parents 66c0552 + d9d6253 commit ccbc201

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
@@ -149,11 +149,13 @@ public static function &create_new($repo_path, $source = null, $remote_source =
149149
$repo = new self($repo_path, true, false);
150150
if (is_string($source)) {
151151
if ($remote_source) {
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";
152+
if (isset($reference)) {
153+
if (!is_dir($reference) || !is_dir($reference.'/.git')) {
154+
throw new Exception('"'.$reference.'" is not a git repository. Cannot use as reference.');
155+
} else if (strlen($reference)) {
156+
$reference = realpath($reference);
157+
$reference = "--reference $reference";
158+
}
157159
}
158160
$repo->clone_remote($source, $reference);
159161
} else {

0 commit comments

Comments
 (0)