mirror of https://git.sr.ht/~sircmpwn/hub.sr.ht
webhooks: prevent error on new/removed git refs
This commit is contained in:
parent
d52edefe18
commit
45a2f75b8b
|
@ -105,6 +105,8 @@ def git_repo(repo_id):
|
||||||
for ref in payload["refs"]:
|
for ref in payload["refs"]:
|
||||||
old = (ref["old"] or {}).get("id")
|
old = (ref["old"] or {}).get("id")
|
||||||
new = (ref["new"] or {}).get("id")
|
new = (ref["new"] or {}).get("id")
|
||||||
|
if not old or not new:
|
||||||
|
continue # New ref, or ref deleted
|
||||||
for commit in reversed(git.log(pusher, repo, old, new)):
|
for commit in reversed(git.log(pusher, repo, old, new)):
|
||||||
for trailer, value in commit_trailers(commit["message"]):
|
for trailer, value in commit_trailers(commit["message"]):
|
||||||
_handle_commit_trailer(trailer, value, pusher, repo, commit)
|
_handle_commit_trailer(trailer, value, pusher, repo, commit)
|
||||||
|
|
Loading…
Reference in New Issue