Skip to content

Commit

Permalink
odb.gpg: Rename sign_buffer to get_gpgsig
Browse files Browse the repository at this point in the history
Although `sign_buffer` is (roughly) the corresponding C function name,
that refers to *mutating* a buffer rather than returning a signature
header value.
  • Loading branch information
rwe committed Jan 10, 2022
1 parent 4545346 commit 7dc58f9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gitrevise/odb.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,20 +311,21 @@ 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

key_id = self.config(
"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,
Expand Down

0 comments on commit 7dc58f9

Please sign in to comment.