Skip to content

Commit 66c0552

Browse files
authored
Merge pull request kbjr#42 from amalmurali47/patch-1
Update Git.php
2 parents 70e883a + b687560 commit 66c0552

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Git.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ public function clean($dirs = false, $force = false) {
466466
* @return string
467467
*/
468468
public function create_branch($branch) {
469-
return $this->run("branch $branch");
469+
return $this->run("branch " . escapeshellarg($branch));
470470
}
471471

472472
/**
@@ -550,7 +550,7 @@ public function active_branch($keep_asterisk = false) {
550550
* @return string
551551
*/
552552
public function checkout($branch) {
553-
return $this->run("checkout $branch");
553+
return $this->run("checkout " . escapeshellarg($branch));
554554
}
555555

556556

@@ -564,7 +564,7 @@ public function checkout($branch) {
564564
* @return string
565565
*/
566566
public function merge($branch) {
567-
return $this->run("merge $branch --no-ff");
567+
return $this->run("merge " . escapeshellarg($branch) . " --no-ff");
568568
}
569569

570570

@@ -588,7 +588,7 @@ public function fetch() {
588588
* @return string
589589
*/
590590
public function add_tag($tag, $message = null) {
591-
if ($message === null) {
591+
if (is_null($message)) {
592592
$message = $tag;
593593
}
594594
return $this->run("tag -a $tag -m " . escapeshellarg($message));
@@ -607,7 +607,7 @@ public function list_tags($pattern = null) {
607607
$tagArray = explode("\n", $this->run("tag -l $pattern"));
608608
foreach ($tagArray as $i => &$tag) {
609609
$tag = trim($tag);
610-
if ($tag == '') {
610+
if (empty($tag)) {
611611
unset($tagArray[$i]);
612612
}
613613
}

0 commit comments

Comments
 (0)