/** * 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; }