Mirror of @tangled.org/core. Running on a Raspberry Pi Zero 2

knotserver/git: move tag signatures out of message

Signed-off-by: oppiliappan <me@oppi.li>

authored by oppi.li and committed by tangled.org deed1628 6a8cc01e

+21 -6
+20 -5
knotserver/git/tag.go
··· 34 "taggername", 35 "taggeremail", 36 "taggerdate:unix", 37 - "contents", 38 } 39 40 var outFormat strings.Builder ··· 97 taggerName := parts[5] 98 taggerEmail := parts[6] 99 taggerDate := parts[7] 100 - message := parts[8] 101 102 // parse creation time 103 var createdAt time.Time ··· 134 Email: taggerEmail, 135 When: createdAt, 136 }, 137 - Message: message, 138 - TargetType: typ, 139 - Target: plumbing.NewHash(targetHash), 140 } 141 142 tags = append(tags, tag)
··· 34 "taggername", 35 "taggeremail", 36 "taggerdate:unix", 37 + "contents:subject", 38 + "contents:body", 39 + "contents:signature", 40 } 41 42 var outFormat strings.Builder ··· 95 taggerName := parts[5] 96 taggerEmail := parts[6] 97 taggerDate := parts[7] 98 + subject := parts[8] 99 + body := parts[9] 100 + signature := parts[10] 101 + 102 + // combine subject and body for the message 103 + var message string 104 + if subject != "" && body != "" { 105 + message = subject + "\n\n" + body 106 + } else if subject != "" { 107 + message = subject 108 + } else { 109 + message = body 110 + } 111 112 // parse creation time 113 var createdAt time.Time ··· 120 Email: taggerEmail, 121 When: createdAt, 122 }, 123 + Message: message, 124 + PGPSignature: signature, 125 + TargetType: typ, 126 + Target: plumbing.NewHash(targetHash), 127 } 128 129 tags = append(tags, tag)
+1 -1
knotserver/git/tag_test.go
··· 323 assert.Equal(s.T(), "Tagger One", v1Tag.Tagger.Name, "tagger name should match") 324 assert.Equal(s.T(), "tagger1@example.com", v1Tag.Tagger.Email, "tagger email should match") 325 326 - assert.Equal(s.T(), "Release version 1.0.0\n\nThis is the first stable release.", 327 v1Tag.Message, "tag message should match") 328 329 assert.Equal(s.T(), plumbing.TagObject, v1Tag.TargetType,
··· 323 assert.Equal(s.T(), "Tagger One", v1Tag.Tagger.Name, "tagger name should match") 324 assert.Equal(s.T(), "tagger1@example.com", v1Tag.Tagger.Email, "tagger email should match") 325 326 + assert.Equal(s.T(), "Release version 1.0.0\n\nThis is the first stable release.\n", 327 v1Tag.Message, "tag message should match") 328 329 assert.Equal(s.T(), plumbing.TagObject, v1Tag.TargetType,