aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/commit.go
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/object/commit.go')
-rw-r--r--plumbing/object/commit.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/plumbing/object/commit.go b/plumbing/object/commit.go
index b1c0e01..00ae3f1 100644
--- a/plumbing/object/commit.go
+++ b/plumbing/object/commit.go
@@ -263,18 +263,18 @@ func (b *Commit) encode(o plumbing.EncodedObject, includeSig bool) (err error) {
}
if b.PGPSignature != "" && includeSig {
- if _, err = fmt.Fprint(w, "\n"+headerpgp); err != nil {
+ if _, err = fmt.Fprint(w, "\n"+headerpgp+" "); err != nil {
return err
}
- // Split all the signature lines and write with a left padding and
- // newline at the end.
+ // Split all the signature lines and re-write with a left padding and
+ // newline. Use join for this so it's clear that a newline should not be
+ // added after this section, as it will be added when the message is
+ // printed.
signature := strings.TrimSuffix(b.PGPSignature, "\n")
lines := strings.Split(signature, "\n")
- for _, line := range lines {
- if _, err = fmt.Fprintf(w, " %s\n", line); err != nil {
- return err
- }
+ if _, err = fmt.Fprint(w, strings.Join(lines, "\n ")); err != nil {
+ return err
}
}