/** * Ensures the fetching of notes is configured for the remote. * * @param string $remote */ public function ensureNotesFetching($remote) { $fetches = StringUtil::splitLines($this->getGitConfig('remote.' . $remote . '.fetch', 'local', true)); if (!in_array('+refs/notes/*:refs/notes/*', $fetches, true)) { $this->getHelperSet()->get('gush_style')->note(sprintf('Set fetching of notes for remote "%s".', $remote)); $this->processHelper->runCommand(['git', 'config', '--add', '--local', 'remote.' . $remote . '.fetch', '+refs/notes/*:refs/notes/*']); } }
/** * @return string */ public function getGitDir() { if (null !== $this->topDir) { return $this->topDir; } $this->topDir = $this->processHelper->runCommand(['git', 'rev-parse', '--show-toplevel']); return $this->topDir; }
public function commit($message, array $options = []) { $params = ''; foreach ($options as $option => $value) { if (is_int($option)) { $params[] = '-' . $value; } else { $params[] = '-' . $option; $params[] = $value; } } $tmpName = $this->filesystemHelper->newTempFilename(); file_put_contents($tmpName, $message); $this->processHelper->runCommand(array_merge(['git', 'commit', '-F', $tmpName], $params)); }
/** * @test * @dataProvider repoUrlProvider */ public function gets_information_about_the_remote($url, array $expectedInfo) { $this->processHelper->expects($this->atLeastOnce())->method('runCommand')->with($this->equalTo('git config --local --get remote.origin.url'))->will($this->returnValue($url)); $this->assertEquals($expectedInfo, $this->gitConfigHelper->getRemoteInfo('origin')); }