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

Commit 9eb1250

Browse files
committed
Rename gpg to pgp
1 parent 8c6ebf5 commit 9eb1250

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

plumbing/object/commit.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ type Commit struct {
3333
// Committer is the one performing the commit, might be different from
3434
// Author.
3535
Committer Signature
36-
// GPGSignature is the GPG signature of the commit.
37-
GPGSignature string
36+
// PGPSignature is the PGP signature of the commit.
37+
PGPSignature string
3838
// Message is the commit message, contains arbitrary text.
3939
Message string
4040
// TreeHash is the hash of the root tree of the commit.
@@ -152,30 +152,30 @@ func (c *Commit) Decode(o plumbing.EncodedObject) (err error) {
152152
r := bufio.NewReader(reader)
153153

154154
var message bool
155-
var gpgsig bool
155+
var pgpsig bool
156156
for {
157157
line, err := r.ReadBytes('\n')
158158
if err != nil && err != io.EOF {
159159
return err
160160
}
161161

162-
if gpgsig {
162+
if pgpsig {
163163
// Check if it's the end of a PGP signature.
164164
if bytes.Contains(line, []byte(endpgp)) {
165-
c.GPGSignature += string(endpgp) + "\n"
166-
gpgsig = false
165+
c.PGPSignature += endpgp + "\n"
166+
pgpsig = false
167167
} else {
168168
// Trim the left padding.
169169
line = bytes.TrimLeft(line, " ")
170-
c.GPGSignature += string(line)
170+
c.PGPSignature += string(line)
171171
}
172172
continue
173173
}
174174

175175
// Check if it's the beginning of a PGP signature.
176176
if bytes.Contains(line, []byte(beginpgp)) {
177-
c.GPGSignature += string(beginpgp) + "\n"
178-
gpgsig = true
177+
c.PGPSignature += beginpgp + "\n"
178+
pgpsig = true
179179
continue
180180
}
181181

@@ -243,14 +243,14 @@ func (b *Commit) Encode(o plumbing.EncodedObject) error {
243243
return err
244244
}
245245

246-
if b.GPGSignature != "" {
247-
if _, err = fmt.Fprint(w, "gpgsig"); err != nil {
246+
if b.PGPSignature != "" {
247+
if _, err = fmt.Fprint(w, "pgpsig"); err != nil {
248248
return err
249249
}
250250

251251
// Split all the signature lines and write with a left padding and
252252
// newline at the end.
253-
lines := strings.Split(b.GPGSignature, "\n")
253+
lines := strings.Split(b.PGPSignature, "\n")
254254
for _, line := range lines {
255255
if _, err = fmt.Fprintf(w, " %s\n", line); err != nil {
256256
return err

plumbing/object/commit_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,12 @@ func (s *SuiteCommit) TestLongCommitMessageSerialization(c *C) {
233233
c.Assert(decoded.Message, Equals, longMessage)
234234
}
235235

236-
func (s *SuiteCommit) TestGPGSignatureSerialization(c *C) {
236+
func (s *SuiteCommit) TestPGPSignatureSerialization(c *C) {
237237
encoded := &plumbing.MemoryObject{}
238238
decoded := &Commit{}
239239
commit := *s.Commit
240240

241-
gpgsignature := `-----BEGIN PGP SIGNATURE-----
241+
pgpsignature := `-----BEGIN PGP SIGNATURE-----
242242
243243
iQEcBAABAgAGBQJTZbQlAAoJEF0+sviABDDrZbQH/09PfE51KPVPlanr6q1v4/Ut
244244
LQxfojUWiLQdg2ESJItkcuweYg+kc3HCyFejeDIBw9dpXt00rY26p05qrpnG+85b
@@ -249,12 +249,12 @@ RUysgqjcpT8+iQM1PblGfHR4XAhuOqN5Fx06PSaFZhqvWFezJ28/CLyX5q+oIVk=
249249
=EFTF
250250
-----END PGP SIGNATURE-----
251251
`
252-
commit.GPGSignature = gpgsignature
252+
commit.PGPSignature = pgpsignature
253253

254254
err := commit.Encode(encoded)
255255
c.Assert(err, IsNil)
256256

257257
err = decoded.Decode(encoded)
258258
c.Assert(err, IsNil)
259-
c.Assert(decoded.GPGSignature, Equals, gpgsignature)
259+
c.Assert(decoded.PGPSignature, Equals, pgpsignature)
260260
}

0 commit comments

Comments
 (0)