~edwargix/git.sr.ht

998c6a7a887dc5e29bf6254734e93314511aea8e — Drew DeVault 6 years ago 84afd9d
Fix post-update webhook payload
2 files changed, 13 insertions(+), 13 deletions(-)

M gitsrht-update-hook/types.go
M gitsrht-update-hook/webhooks.go
M gitsrht-update-hook/types.go => gitsrht-update-hook/types.go +0 -13
@@ 54,19 54,6 @@ type Commit struct {
	Signature *CommitSignature `json:"signature"`
}

type UpdatedRef struct {
	Tag  *AnnotatedTag `json:"annotated_tag",omitempty`
	Name string        `json:"name"`
	Old  *Commit       `json:"old"`
	New  *Commit       `json:"commit"`
}

type WebhookPayload struct {
	Push   string       `json:"push"`
	Pusher UserContext  `json:"pusher"`
	Refs   []UpdatedRef `json:"refs"`
}

func GitCommitToWebhookCommit(c *object.Commit) *Commit {
	parents := make([]string, len(c.ParentHashes))
	for i, p := range c.ParentHashes {

M gitsrht-update-hook/webhooks.go => gitsrht-update-hook/webhooks.go +13 -0
@@ 42,6 42,19 @@ type WebhookDelivery struct {
	Url             string
}

type UpdatedRef struct {
	Tag  *AnnotatedTag `json:"annotated_tag",omitempty`
	Name string        `json:"name"`
	Old  *Commit       `json:"old"`
	New  *Commit       `json:"new"`
}

type WebhookPayload struct {
	Push   string       `json:"push"`
	Pusher UserContext  `json:"pusher"`
	Refs   []UpdatedRef `json:"refs"`
}

func initWebhookKey() {
	b64key, ok := config.Get("webhooks", "private-key")
	if !ok {