Skip to content

Commit 70e883a

Browse files
authored
Merge pull request kbjr#37 from MobilityWare/master
Bug fixes and enhancements to Git.php to resolve problems…
2 parents 0d1a996 + 0d93c63 commit 70e883a

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

Git.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ public static function open($repo_path) {
9696
* @return GitRepo
9797
**/
9898
public static function &clone_remote($repo_path, $remote, $reference = null) {
99-
return GitRepo::create_new($repo_path, $remote, true, $reference);
99+
//Changed the below boolean from true to false, since this appears to be a bug when not using a reference repo. A more robust solution may be appropriate to make it work with AND without a reference.
100+
return GitRepo::create_new($repo_path, $remote, false, $reference);
100101
}
101102

102103
/**
@@ -314,7 +315,7 @@ protected function run_command($command) {
314315
}
315316

316317
$status = trim(proc_close($resource));
317-
if ($status) throw new Exception($stderr);
318+
if ($status) throw new Exception($stderr . "\n" . $stdout); //Not all errors are printed to stderr, so include std out as well.
318319

319320
return $stdout;
320321
}
@@ -615,28 +616,33 @@ public function list_tags($pattern = null) {
615616
}
616617

617618
/**
618-
* Push specific branch to a remote
619+
* Push specific branch (or all branches) to a remote
619620
*
620-
* Accepts the name of the remote and local branch
621+
* Accepts the name of the remote and local branch.
622+
* If omitted, the command will be "git push", and therefore will take
623+
* on the behavior of your "push.defualt" configuration setting.
621624
*
622625
* @param string $remote
623626
* @param string $branch
624627
* @return string
625628
*/
626-
public function push($remote, $branch) {
627-
return $this->run("push --tags $remote $branch");
629+
public function push($remote = "", $branch = "") {
630+
//--tags removed since this was preventing branches from being pushed (only tags were)
631+
return $this->run("push $remote $branch");
628632
}
629633

630634
/**
631635
* Pull specific branch from remote
632636
*
633-
* Accepts the name of the remote and local branch
637+
* Accepts the name of the remote and local branch.
638+
* If omitted, the command will be "git pull", and therefore will take on the
639+
* behavior as-configured in your clone / environment.
634640
*
635641
* @param string $remote
636642
* @param string $branch
637643
* @return string
638644
*/
639-
public function pull($remote, $branch) {
645+
public function pull($remote = "", $branch = "") {
640646
return $this->run("pull $remote $branch");
641647
}
642648

0 commit comments

Comments
 (0)