diff --git a/reno/scanner.py b/reno/scanner.py index 949c6ab..75c2fac 100644 --- a/reno/scanner.py +++ b/reno/scanner.py @@ -385,7 +385,15 @@ class Scanner(object): # on master, so this is the base. tags = self._repo.get_tags_on_commit( c.commit.sha().hexdigest().encode('ascii')) - return tags[-1] + if tags: + return tags[-1] + else: + # Naughty, naughty, branching without tagging. + LOG.error( + ('There is no tag on commit %s at the base of %s. ' + 'Branch scan short-cutting is disabled.'), + c.commit.sha().hexdigest(), branch) + return None return None def _topo_traversal(self, branch): diff --git a/reno/tests/test_scanner.py b/reno/tests/test_scanner.py index 11b8564..62c4fa8 100644 --- a/reno/tests/test_scanner.py +++ b/reno/tests/test_scanner.py @@ -933,6 +933,15 @@ class BranchBaseTest(Base): self.scanner._get_branch_base('not-master'), ) + def test_no_tag_at_base(self): + # remove the tag at the branch point + self.repo.git('tag', '-d', '2.0.0') + self._add_notes_file('slug4') + self.repo.git('checkout', 'master') + self.assertIsNone( + self.scanner._get_branch_base('not-master') + ) + class BranchTest(Base):