Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 699894 - Post-receive webhook error when deleting a remote branch
Summary: Post-receive webhook error when deleting a remote branch
Status: CONFIRMED
Alias: None
Product: Gentoo Infrastructure
Classification: Unclassified
Component: Git (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Infrastructure
URL:
Whiteboard:
Keywords:
: 706370 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-11-11 21:41 UTC by Göktürk Yüksek
Modified: 2022-06-16 03:21 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Göktürk Yüksek archtester gentoo-dev 2019-11-11 21:41:34 UTC
Hi,

When I tried to delete a remote branch on devmanual, I got the following error:

```
$ git push -d origin pkg_pretend_improvement
remote: fatal: Invalid revision range d60840bad84d133aa2b97c7dcebf3e5e4942d17a..0000000000000000000000000000000000000000
remote: To github.com:gentoo/devmanual.gentoo.org.git
remote:  - [deleted]         pkg_pretend_improvement
remote: fatal: Invalid revision range d60840bad84d133aa2b97c7dcebf3e5e4942d17a..0000000000000000000000000000000000000000
remote: Traceback (most recent call last):
remote:   File "hooks/post-receive.h03-notify-webhook", line 335, in <module>
remote:     main(sys.stdin)
remote:   File "hooks/post-receive.h03-notify-webhook", line 321, in main
remote:     data = make_json(old, new, ref)
remote:   File "hooks/post-receive.h03-notify-webhook", line 251, in make_json
remote:     revisions = get_revisions(old, new)
remote:   File "hooks/post-receive.h03-notify-webhook", line 129, in get_revisions
remote:     props = {'id': lines[0].strip().split(' ')[1], 'added': [], 'removed': [], 'modified': []}
remote: IndexError: list index out of range
To git+ssh://git.gentoo.org/proj/devmanual.git
 - [deleted]         pkg_pretend_improvement
```
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2019-12-18 07:24:58 UTC
Fixed here:
https://github.com/metajack/notify-webhook/issues/18
Comment 2 Ulrich Müller gentoo-dev 2021-03-15 06:42:57 UTC
Not fixed. I got the same error today, when deleting a branch in proj/emacs-tools.git:

~/git/emacs-tools $ git push -d origin patchsets
remote: Traceback (most recent call last):
remote:   File "hooks/post-receive.h03-notify-webhook", line 410, in <module>
remote:     main(sys.stdin)
remote:   File "hooks/post-receive.h03-notify-webhook", line 397, in main
remote:     data = make_json(old, new, ref)
remote:   File "hooks/post-receive.h03-notify-webhook", line 316, in make_json
remote:     revisions = get_revisions(old, new)
remote:   File "hooks/post-receive.h03-notify-webhook", line 177, in get_revisions
remote:     ' ')[1], 'added': [], 'removed': [], 'modified': []}
remote: IndexError: list index out of range
To git+ssh://git.gentoo.org/proj/emacs-tools.git
 - [deleted]         patchsets
Comment 3 Ulrich Müller gentoo-dev 2021-03-15 07:25:50 UTC
The upstream script at https://github.com/metajack/notify-webhook/blob/master/notify-webhook.py#L167 does this:

    revs = git(['rev-list', '--pretty=medium', '--reverse', commit_range])
    sections = revs.split('\n\n')

    revisions = []
    s = 0
    while s < len(sections):

revs is an empty string as expected, but sections is _not_ an empty list, but a list with one empty element.

So the while loop is entered which is where it fails.
Comment 4 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2022-06-16 03:21:18 UTC
*** Bug 706370 has been marked as a duplicate of this bug. ***