aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2017-05-23 07:59:38 +0200
committerGuido Günther <agx@sigxcpu.org>2017-05-23 08:17:32 +0200
commitbe6af1e1f957abd01be0dbe1834630664b53fdbf (patch)
tree92124918c178b2cbb768c0c18816e057e348e147
parent8ea5d6f4e48687ba4ce195c41bbc27684e092f10 (diff)
Test that we don't fail tagging when on pq branch
Closes: #863167
-rwxr-xr-xgbp/scripts/buildpackage.py2
-rw-r--r--tests/component/deb/test_buildpackage.py16
2 files changed, 17 insertions, 1 deletions
diff --git a/gbp/scripts/buildpackage.py b/gbp/scripts/buildpackage.py
index 0922ff9..e0ae07c 100755
--- a/gbp/scripts/buildpackage.py
+++ b/gbp/scripts/buildpackage.py
@@ -794,7 +794,7 @@ def main(argv):
'GBP_BUILD_DIR': build_dir})
)()
if options.tag or options.tag_only:
- if is_pq_branch(branch):
+ if branch and is_pq_branch(branch):
commit = repo.get_merge_base(branch, pq_branch_base(branch))
else:
commit = head
diff --git a/tests/component/deb/test_buildpackage.py b/tests/component/deb/test_buildpackage.py
index b149936..1de9be5 100644
--- a/tests/component/deb/test_buildpackage.py
+++ b/tests/component/deb/test_buildpackage.py
@@ -226,6 +226,22 @@ class TestBuildpackage(ComponentTestBase):
eq_(repo.rev_parse('patch-queue/master^{}^'), repo.rev_parse('debian/2.8-1^{}'))
@RepoFixtures.quilt30()
+ def test_tag_detached_head(self, repo):
+ """
+ Test that tagging works with an detached head (#863167)
+ """
+ eq_(repo.rev_parse('master^{}'), repo.rev_parse('debian/2.8-1^{}'))
+ self.add_file(repo, 'debian/foo.txt')
+ repo.checkout("HEAD~")
+ ret = buildpackage(['argv0',
+ '--git-tag-only',
+ '--git-retag',
+ '--git-ignore-branch'])
+ eq_(ret, 0)
+ repo.checkout("master")
+ eq_(repo.rev_parse('master~^{}'), repo.rev_parse('debian/2.8-1^{}'))
+
+ @RepoFixtures.quilt30()
def test_broken_upstream_version(self, repo):
cl = ChangeLog(filename='debian/changelog')
cl.add_section(["broken versionnumber"],