buildpackage: Tag currently checked out head
authorGuido Günther <agx@sigxcpu.org>
Thu, 29 Jan 2015 08:25:38 +0000 (09:25 +0100)
committerGuido Günther <agx@sigxcpu.org>
Thu, 29 Jan 2015 09:57:39 +0000 (10:57 +0100)
Tag the head checked out at command invocation. The build can
take some time and the repo might have changed underneath us.

Closes: #776506
gbp/scripts/buildpackage.py

index e4ec26a8ae974be54a90909d7e2e6fba3293c76d..1c48c054320e2606d19711623d1f3f0480530c31 100755 (executable)
@@ -534,6 +534,7 @@ def main(argv):
                 gbp.log.err("You are not on branch '%s' but on '%s'" % (options.debian_branch, branch))
                 raise GbpError("Use --git-ignore-branch to ignore or --git-debian-branch to set the branch name.")
 
+        head = repo.head
         tree = write_tree(repo, options)
         source = source_vfs(repo, options, tree)
         if not options.tag_only:
@@ -609,7 +610,9 @@ def main(argv):
                                       version=source.changelog.version))
             repo.create_tag(name=tag,
                             msg=tag_msg,
-                            sign=options.sign_tags, keyid=options.keyid)
+                            sign=options.sign_tags,
+                            commit=head,
+                            keyid=options.keyid)
             if options.posttag:
                 sha = repo.rev_parse("%s^{}" % tag)
                 Hook('Posttag', options.posttag, shell=True,