/** * Retrieve the latest tag from a branch. * * @param string $branch The branch name to retrieve the tag from. * * @return null|string Returns null when no tag has been found, the tag name otherwise. */ protected function getTagFromBranch($branch) { $git = new GitRepository($this->input->getArgument('git-dir')); $tag = trim($git->describe()->tags()->always()->execute($branch)); $hash = trim($git->revParse()->short(false)->execute($branch)); return $hash !== $tag ? $tag : null; }
/** * @covers \Bit3\GitPhp\GitRepository::describe * @covers \Bit3\GitPhp\Command\DescribeCommandBuilder::execute */ public function testDescribeOnUninitializedRepository() { $this->setExpectedException('Bit3\\GitPhp\\GitException'); $this->uninitializedGitRepository->describe()->execute(); }
protected function execute(InputInterface $input, OutputInterface $output) { $git = new GitRepository($input->getArgument('docroot')); $current_tag = $git->describe()->tags()->execute(); $output->writeln($current_tag); }