Ejemplo n.º 1
0
 /**
  * Fetches the branches via the `git branch` command.
  *
  * @param boolean $only_remote
  *   Whether to fetch only remote branches, defaults to false which returns
  *   all branches.
  *
  * @return array
  */
 public function fetchLocalBranches()
 {
     $this->git->clearOutput();
     $output = (string) $this->git->branch();
     $branches = preg_split("/\r\n|\n|\r/", rtrim($output));
     return array_map(array($this, 'trimBranch'), $branches);
 }
Ejemplo n.º 2
0
 /**
  * Constructs a GitBranches object.
  *
  * @param \GitWrapper\GitWorkingCopy $git
  *   The working copy that branches are being collected from.
  *
  * @throws \GitWrapper\GitException
  */
 public function __construct(GitWorkingCopy $git)
 {
     $this->git = clone $git;
     $output = (string) $git->branch(array('a' => true));
 }