Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

git: Add tagging support #928

Merged
merged 14 commits into from
Sep 10, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
plumbing: object, don't add extra newline on PGP signature
Tag encoding/decoding seems to be a lot more sensitive to requiring the
exact expected format in the object, which generally includes messages
canonicalized so that they have a newline on the end (even if they
didn't before).

As such, the message should be written with the newline (no need for an
extra), and the PGP signature right after that, which will be newline
split already, so there's no need to split it again.

All of this means it's very important for the caller to send the message
in the correct format - which I'm correcting in the next commit.

Signed-off-by: Chris Marchesi <[email protected]>
  • Loading branch information
vancluever committed Aug 22, 2018
commit 8c3c8b30b3394677d8eb16b159bfe9b4f61726a8
7 changes: 6 additions & 1 deletion plumbing/object/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,13 @@ func (t *Tag) encode(o plumbing.EncodedObject, includeSig bool) (err error) {
return err
}

// Note that this is highly sensitive to what it sent along in the message.
// Message *always* needs to end with a newline, or else the message and the
// signature will be concatenated into a corrupt object. Since this is a
// lower-level method, we assume you know what you are doing and have already
// done the needful on the message in the caller.
if includeSig {
if _, err = fmt.Fprint(w, "\n"+t.PGPSignature); err != nil {
if _, err = fmt.Fprint(w, t.PGPSignature); err != nil {
return err
}
}
Expand Down