aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2018-09-10 13:04:42 +0200
committerGitHub <noreply@github.com>2018-09-10 13:04:42 +0200
commit38060c9c17a8485c03873d06b465b65dbe6bd325 (patch)
treef0273e3453020498defff396e3d62e9f33436468 /plumbing/object
parenta2d62f58ea626bb9f41de6431f6f18ca92cf78a0 (diff)
parent9ce4eeab99708a2ac35124585103f9e4a04126df (diff)
downloadgo-git-38060c9c17a8485c03873d06b465b65dbe6bd325.tar.gz
Merge pull request #928 from vancluever/f-add-tagging-support
git: Add tagging support
Diffstat (limited to 'plumbing/object')
-rw-r--r--plumbing/object/tag.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/plumbing/object/tag.go b/plumbing/object/tag.go
index 905206b..03749f9 100644
--- a/plumbing/object/tag.go
+++ b/plumbing/object/tag.go
@@ -195,13 +195,14 @@ func (t *Tag) encode(o plumbing.EncodedObject, includeSig bool) (err error) {
return err
}
- if t.PGPSignature != "" && includeSig {
- // Split all the signature lines and write with a newline at the end.
- lines := strings.Split(t.PGPSignature, "\n")
- for _, line := range lines {
- if _, err = fmt.Fprintf(w, "%s\n", line); err != nil {
- 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, t.PGPSignature); err != nil {
+ return err
}
}