public function testFetch() { $git = new Git(); $git->init($this->directory); $git->setRepository($this->directory); $git->remote->add('origin', 'https://github.com/kzykhys/Text.git'); $git->fetch('origin', '+refs/heads/*:refs/remotes/origin/*'); $tags = $git->tag(); $this->assertContains('v1.0.0', $tags); }
/** * Get all versions for the given manual. * * @param string $manual * @return array */ public function getVersions($manual) { $manualDir = $this->storagePath . '/' . $manual; return $this->cache->remember("cache.{$manual}.branches", 10, function () use($manualDir) { $this->git->setRepository($manualDir); $this->git->fetch('origin'); return array_filter(array_map(function ($branch) { return preg_replace('/[\\w]+?\\//', '', $branch['name']); }, $this->git->branch(['remotes' => true])), function ($branch) { return $branch !== 'HEAD'; }); }); }