From 7dc58f9062db2501daf83f46241fba5f4ce308bd Mon Sep 17 00:00:00 2001 From: Robert Estelle Date: Thu, 16 Sep 2021 16:52:25 -0700 Subject: [PATCH] odb.gpg: Rename sign_buffer to get_gpgsig Although `sign_buffer` is (roughly) the corresponding C function name, that refers to *mutating* a buffer rather than returning a signature header value. --- gitrevise/odb.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gitrevise/odb.py b/gitrevise/odb.py index 47537b2..3dcffef 100644 --- a/gitrevise/odb.py +++ b/gitrevise/odb.py @@ -311,13 +311,13 @@ def new_commit( body_tail = b"\n" + message if self.sign_commits: - gpgsig = self.sign_buffer(body + body_tail) + gpgsig = self.get_gpgsig(body + body_tail) body += b"gpgsig " + gpgsig.replace(b"\n", b"\n ") + b"\n" body += body_tail return Commit(self, body) - def sign_buffer(self, buffer: bytes) -> bytes: + def get_gpgsig(self, buffer: bytes) -> bytes: """Return the text of the signed commit object.""" from .utils import sh_run # pylint: disable=import-outside-toplevel @@ -325,6 +325,7 @@ def sign_buffer(self, buffer: bytes) -> bytes: "user.signingKey", default=self.default_committer.signing_key ) try: + # See git/gpg-interface.c:sign_buffer for reference gpg = sh_run( (self.gpg, "--status-fd=2", "-bsau", key_id), stdout=PIPE,