got: omit empty for author, difstat. use committer for String()
This commit is contained in:
parent
3dab4d2d75
commit
8d6703594b
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ mcchunkie
|
|||||||
deploy.sh
|
deploy.sh
|
||||||
*.core
|
*.core
|
||||||
.direnv
|
.direnv
|
||||||
|
result
|
||||||
|
6
got.go
6
got.go
@ -43,18 +43,18 @@ type Notification struct {
|
|||||||
Short bool `json:"short"`
|
Short bool `json:"short"`
|
||||||
Repo string `json:"repo"`
|
Repo string `json:"repo"`
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Author Author `json:"author"`
|
Author Author `json:"author,omitempty"`
|
||||||
Committer Committer `json:"committer"`
|
Committer Committer `json:"committer"`
|
||||||
Date string `json:"date"`
|
Date string `json:"date"`
|
||||||
ShortMessage string `json:"short_message"`
|
ShortMessage string `json:"short_message"`
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
Diffstat Diffstat `json:"diffstat"`
|
Diffstat Diffstat `json:"diffstat,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Notification) String() string {
|
func (n *Notification) String() string {
|
||||||
// op committed got.git f9e653700..f9e653700^1 (main): fix gotd_parse_url() (https://git.gameoftrees.org/gitweb/?p=got.git;a=commitdiff;h=f9e653700)
|
// op committed got.git f9e653700..f9e653700^1 (main): fix gotd_parse_url() (https://git.gameoftrees.org/gitweb/?p=got.git;a=commitdiff;h=f9e653700)
|
||||||
return fmt.Sprintf("%s committed %s %s: %s (%s)",
|
return fmt.Sprintf("%s committed %s %s: %s (%s)",
|
||||||
n.Author.User,
|
n.Committer.User,
|
||||||
n.Repo,
|
n.Repo,
|
||||||
n.ID,
|
n.ID,
|
||||||
n.ShortMessage,
|
n.ShortMessage,
|
||||||
|
8
got_test.sh
Executable file
8
got_test.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo "line one is here" > /tmp/test
|
||||||
|
echo "line two is here" >> /tmp/test
|
||||||
|
echo "line <two> is here" >> /tmp/test
|
||||||
|
|
||||||
|
curl --basic --user got:butters --data-urlencode file@/tmp/test -o - "http://localhost:8043/_got"
|
||||||
|
curl -X POST -H "Content-Type: application/json" --data @test_body.json --basic --user got:butters -o - "http://localhost:8043/_got/v2"
|
9
live_got_test.sh
Executable file
9
live_got_test.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
PW="$(op item get got-test --field password)"
|
||||||
|
|
||||||
|
echo "test one two three" > /tmp/test
|
||||||
|
|
||||||
|
curl --basic --user got:${PW} --data-urlencode file@/tmp/test -o - "https://suah.dev/_got"
|
||||||
|
curl -X POST -H "Content-Type: application/json" --data @test_body.json --basic --user got:${PW} -o - "https://suah.dev/_got/v2"
|
||||||
|
|
89
test_body.json
Normal file
89
test_body.json
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
{
|
||||||
|
"notifications": [
|
||||||
|
{
|
||||||
|
"type": "commit",
|
||||||
|
"short": false,
|
||||||
|
"repo": "test-repo",
|
||||||
|
"id": "34d7c970d4bd3a5832ecded86f2c28e83dbba2ba",
|
||||||
|
"author": {
|
||||||
|
"full": "Flan Hacker <flan@openbsd.org>",
|
||||||
|
"name": "Flan Hacker",
|
||||||
|
"mail": "flan@openbsd.org",
|
||||||
|
"user": "flan"
|
||||||
|
},
|
||||||
|
"committer": {
|
||||||
|
"full": "Flan Hacker <flan@openbsd.org>",
|
||||||
|
"name": "Flan Hacker",
|
||||||
|
"mail": "flan@openbsd.org",
|
||||||
|
"user": "flan"
|
||||||
|
},
|
||||||
|
"date": "Thu Apr 18 16:47:40 2024 UTC",
|
||||||
|
"short_message": "make changes",
|
||||||
|
"message": "make changes\n",
|
||||||
|
"diffstat": {
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"action": "modified",
|
||||||
|
"file": "alpha",
|
||||||
|
"added": 1,
|
||||||
|
"removed": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"total": {
|
||||||
|
"added": 1,
|
||||||
|
"removed": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "commit",
|
||||||
|
"short": false,
|
||||||
|
"repo": "repo-test",
|
||||||
|
"id": "a4d7c970d4bd3a5832ecded86f2c28e83dbba2ba",
|
||||||
|
"author": {
|
||||||
|
"full": "Flan Slacker <flans@openbsd.org>",
|
||||||
|
"name": "Flan Slacker",
|
||||||
|
"mail": "flans@openbsd.org",
|
||||||
|
"user": "flans"
|
||||||
|
},
|
||||||
|
"committer": {
|
||||||
|
"full": "Flan Slacker <flan@openbsd.org>",
|
||||||
|
"name": "Flan Slacker",
|
||||||
|
"mail": "flans@openbsd.org",
|
||||||
|
"user": "flans"
|
||||||
|
},
|
||||||
|
"date": "Thu Apr 18 16:48:40 2024 UTC",
|
||||||
|
"short_message": "make more changes",
|
||||||
|
"message": "make more changes\n",
|
||||||
|
"diffstat": {
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"action": "modified",
|
||||||
|
"file": "alpha",
|
||||||
|
"added": 3,
|
||||||
|
"removed": 8
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"total": {
|
||||||
|
"added": 1,
|
||||||
|
"removed": 9
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "commit",
|
||||||
|
"short": false,
|
||||||
|
"repo": "repo-test",
|
||||||
|
"id": "f4d7c970d4bd3a5832ecded86f2c28e83dbba2ba",
|
||||||
|
"committer": {
|
||||||
|
"full": "Flan Slacker <flan@openbsd.org>",
|
||||||
|
"name": "Flan Slacker",
|
||||||
|
"mail": "flans@openbsd.org",
|
||||||
|
"user": "flans"
|
||||||
|
},
|
||||||
|
"date": "Thu Apr 19 16:48:40 2024 UTC",
|
||||||
|
"short_message": "revert changes",
|
||||||
|
"message": "revert all the previous changes\n"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user