Disable PGP signatures when retrieving list of commits
authorGabriel Filion <gabster@lelutin.ca>
Sun, 24 Feb 2019 01:03:41 +0000 (20:03 -0500)
committerGuido Günther <agx@sigxcpu.org>
Sun, 24 Feb 2019 11:34:53 +0000 (12:34 +0100)
gbp dch errors out with the following output if the "log.showSignature"
git config is enabled:

$ gbp dch --verbose
gbp:debug: ['git', 'rev-parse', '--show-cdup']
gbp:debug: ['git', 'rev-parse', '--is-bare-repository']
gbp:debug: ['git', 'rev-parse', '--git-dir']
gbp:debug: ['git', 'symbolic-ref', 'HEAD']
gbp:debug: ['git', 'show-ref', 'refs/heads/master']
gbp:debug: ['git', 'tag', '-l', 'debian/2.7.3-2']
gbp:debug: ['git', 'tag', '-l', 'debian/2.7.3-2']
gbp:debug: ['git', 'log', '--pretty=format:%H', '-1', '--', 'debian/changelog']
gbp:info: Changelog last touched at 'gpg: Signature made Fri 01 Feb 2019 03:56:19 PM EST'
gbp:debug: ['git', 'log', '--pretty=format:%H', 'gpg: Signature made Fri 01 Feb 2019 03:56:19 PM EST..HEAD', '--no-merges', '--']
fatal: bad revision 'gpg: Signature made Fri 01 Feb 2019 03:56:19 PM EST..HEAD'
gbp:error: Error getting commits gpg: Signature made Fri 01 Feb 2019 03:56:19 PM EST..HEAD

This is caused by gbp dch receiving unexpected output for the PGP
signatures and trying to use this unexpected output.

To avoid any surprises, let's disable signatures being output when we
list commits.

Also, when collecting a shortlog-like output from commit objects, the
same unexpected PGP signature output is sprayed all over the changelog.
We'll avoid this by also disable showing signatures when showing each
commit's first line.

Closes: #923087
gbp/git/repository.py

index a44c71e176cd48bdc573037f076c8fba03130610..dfc8e55617f17c5ad996da352fad2a8930af7445 100644 (file)
@@ -1613,7 +1613,7 @@ class GitRepository(object):
                              merge commit
         @type first_parent: C{bool}
         """
-        args = GitArgs('--pretty=format:%H')
+        args = GitArgs('--pretty=format:%H', '--no-show-signature')
         args.add_true(num, '-%d' % num)
         args.add_true(first_parent, '--first-parent')
         if since:
@@ -1694,7 +1694,7 @@ class GitRepository(object):
         commit_sha1 = self.rev_parse("%s^0" % commitish)
         args = GitArgs('--pretty=format:%an%x00%ae%x00%ad%x00%cn%x00%ce%x00%cd%x00%s%x00%f%x00%b%x00',
                        '-z', '--date=raw', '--no-renames', '--name-status',
-                       commit_sha1)
+                       '--no-show-signature', commit_sha1)
         out, err, ret = self._git_inout('show', args.args)
         if ret:
             raise GitRepositoryError("Unable to retrieve commit info for %s"