loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Rename CommitGPGSignature to ObjectSignature

`CommitGPGSignature` was originally made to store information about a
commit's GPG signature. Nowadays, it is used to store information about
SSH signatures too, and not just commit signatures, but tag signatures
too.

As such, rename it to `ObjectSignature`, because that describes what it
does a whole lot better.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>

authored by

Gergely Nagy and committed by
oliverpool
40c357bb 8fdffc94

+26 -21
+4 -4
models/asymkey/ssh_key_commit_verification_test.go
··· 40 40 Committer: &git.Signature{ 41 41 Email: "non-existent", 42 42 }, 43 - Signature: &git.CommitGPGSignature{ 43 + Signature: &git.ObjectSignature{ 44 44 Payload: `tree 2d491b2985a7ff848d5c02748e7ea9f9f7619f9f 45 45 parent 45b03601635a1f463b81963a4022c7f87ce96ef9 46 46 author user2 <non-existent> 1699710556 +0100 ··· 67 67 Committer: &git.Signature{ 68 68 Email: "user2@example.com", 69 69 }, 70 - Signature: &git.CommitGPGSignature{ 70 + Signature: &git.ObjectSignature{ 71 71 Payload: `tree 853694aae8816094a0d875fee7ea26278dbf5d0f 72 72 parent c2780d5c313da2a947eae22efd7dacf4213f4e7f 73 73 author user2 <user2@example.com> 1699707877 +0100 ··· 89 89 Committer: &git.Signature{ 90 90 Email: "user2@example.com", 91 91 }, 92 - Signature: &git.CommitGPGSignature{ 92 + Signature: &git.ObjectSignature{ 93 93 Payload: `tree 853694aae8816094a0d875fee7ea26278dbf5d0f 94 94 parent c2780d5c313da2a947eae22efd7dacf4213f4e7f 95 95 author user2 <user2@example.com> 1699707877 +0100 ··· 120 120 Committer: &git.Signature{ 121 121 Email: "user2@noreply.example.com", 122 122 }, 123 - Signature: &git.CommitGPGSignature{ 123 + Signature: &git.ObjectSignature{ 124 124 Payload: `tree 4836c7f639f37388bab4050ef5c97bbbd54272fc 125 125 parent 795be1b0117ea5c65456050bb9fd84744d4fd9c6 126 126 author user2 <user2@noreply.example.com> 1699709594 +0100
+1 -7
modules/git/commit.go
··· 25 25 Author *Signature 26 26 Committer *Signature 27 27 CommitMessage string 28 - Signature *CommitGPGSignature 28 + Signature *ObjectSignature 29 29 30 30 Parents []ObjectID // ID strings 31 31 submoduleCache *ObjectCache 32 - } 33 - 34 - // CommitGPGSignature represents a git commit signature part. 35 - type CommitGPGSignature struct { 36 - Signature string 37 - Payload string // TODO check if can be reconstruct from the rest of commit information to not have duplicate data 38 32 } 39 33 40 34 // Message returns the commit message. Same as retrieving CommitMessage directly.
+2 -2
modules/git/commit_convert_gogit.go
··· 13 13 "github.com/go-git/go-git/v5/plumbing/object" 14 14 ) 15 15 16 - func convertPGPSignature(c *object.Commit) *CommitGPGSignature { 16 + func convertPGPSignature(c *object.Commit) *ObjectSignature { 17 17 if c.PGPSignature == "" { 18 18 return nil 19 19 } ··· 51 51 return nil 52 52 } 53 53 54 - return &CommitGPGSignature{ 54 + return &ObjectSignature{ 55 55 Signature: c.PGPSignature, 56 56 Payload: w.String(), 57 57 }
+1 -1
modules/git/commit_reader.go
··· 97 97 } 98 98 } 99 99 commit.CommitMessage = messageSB.String() 100 - commit.Signature = &CommitGPGSignature{ 100 + commit.Signature = &ObjectSignature{ 101 101 Signature: signatureSB.String(), 102 102 Payload: payloadSB.String(), 103 103 }
+11
modules/git/object_signature.go
··· 1 + // Copyright 2015 The Gogs Authors. All rights reserved. 2 + // Copyright 2019 The Gitea Authors. All rights reserved. 3 + // SPDX-License-Identifier: MIT 4 + 5 + package git 6 + 7 + // ObjectSignature represents a git object (commit, tag) signature part. 8 + type ObjectSignature struct { 9 + Signature string 10 + Payload string // TODO check if can be reconstruct from the rest of commit information to not have duplicate data 11 + }
+2 -2
modules/git/repo_tag.go
··· 196 196 } 197 197 } 198 198 199 - // annotated tag with GPG signature 199 + // annotated tag with signature 200 200 if tag.Type == "tag" && ref["contents:signature"] != "" { 201 201 payload := fmt.Sprintf("object %s\ntype commit\ntag %s\ntagger %s\n\n%s\n", 202 202 tag.Object, tag.Name, ref["creator"], strings.TrimSpace(tag.Message)) 203 - tag.Signature = &CommitGPGSignature{ 203 + tag.Signature = &ObjectSignature{ 204 204 Signature: ref["contents:signature"], 205 205 Payload: payload, 206 206 }
+1 -1
modules/git/repo_tag_test.go
··· 315 315 Type: "tag", 316 316 Tagger: parseSignatureFromCommitLine("Foo Bar <foo@bar.com> 1565789218 +0300"), 317 317 Message: "Add changelog of v1.9.1 (#7859)\n\n* add changelog of v1.9.1\n* Update CHANGELOG.md", 318 - Signature: &CommitGPGSignature{ 318 + Signature: &ObjectSignature{ 319 319 Signature: `-----BEGIN PGP SIGNATURE----- 320 320 321 321 aBCGzBAABCgAdFiEEyWRwv/q1Q6IjSv+D4IPOwzt33PoFAmI8jbIACgkQ4IPOwzt3
+3 -3
modules/git/tag.go
··· 26 26 Type string 27 27 Tagger *Signature 28 28 Message string 29 - Signature *CommitGPGSignature 29 + Signature *ObjectSignature 30 30 } 31 31 32 32 // Commit return the commit of the tag reference ··· 74 74 } 75 75 } 76 76 77 - extractTagSignature := func(signatureBeginMark, signatureEndMark string) (bool, *CommitGPGSignature, string) { 77 + extractTagSignature := func(signatureBeginMark, signatureEndMark string) (bool, *ObjectSignature, string) { 78 78 idx := strings.LastIndex(tag.Message, signatureBeginMark) 79 79 if idx == -1 { 80 80 return false, nil, "" ··· 85 85 return false, nil, "" 86 86 } 87 87 88 - return true, &CommitGPGSignature{ 88 + return true, &ObjectSignature{ 89 89 Signature: tag.Message[idx+1 : idx+endSigIdx+len(signatureEndMark)], 90 90 Payload: string(data[:bytes.LastIndex(data, []byte(signatureBeginMark))+1]), 91 91 }, tag.Message[:idx+1]
+1 -1
modules/git/tag_test.go
··· 65 65 Type: "commit", 66 66 Tagger: &Signature{Name: "Jane Doe", Email: "jane.doe@example.com", When: time.Unix(1709146405, 0)}, 67 67 Message: "v0\n", 68 - Signature: &CommitGPGSignature{ 68 + Signature: &ObjectSignature{ 69 69 Signature: `-----BEGIN SSH SIGNATURE----- 70 70 U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgvD4pK7baygXxoWoVoKjVEc/xZh 71 71 6w+1FUn5hypFqJXNAAAAADZ2l0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5