Make keyword parsing hook script intelligent enough to parse multiple keywords on one line
Closed, InvalidPublic

Description

GitLab has an annoying issue where single line breaks get removed. Because of this, if I write the following in a merge request:

BUG: 341318
BUG: 295506
BUG: 309808
BUG: 200183

...It turns out like this: BUG: 341318 BUG: 295506 BUG: 309808 BUG: 200183

Then when the merge request lands, the commit hookscript doesn't recognize that kind of input and none of the bugs get closed.

For a recent example, see https://invent.kde.org/kde/okular/merge_requests/39

This behavior or removing the newlines seems like a bug in GitLab, and we can work around it by instead writing out the keywords like this:

BUG: 341318

BUG: 295506

BUG: 309808

BUG: 200183

But people are going to forget to do this. Can we make the hookscript more intelligent so that you don't need to put each keyword on a newline?

ngraham created this task.Oct 2 2019, 4:46 PM
mglb added a subscriber: mglb.Oct 15 2019, 10:42 PM

Gitlab's Merge Request description is not placed in a commit (at least when there is no merge commit, which is default). Each commit in merge request has its own independent description.
Please see "02 Oct, 2019 (5 commits)" in https://invent.kde.org/kde/okular/commits/master - this is the result of mentioned merge. Hooks didn't catch bug entries because they are not in commits.

Oh jeez, darn. I guess it's up to the person merging it to make sure that the merge/squashed commit has the BUG tags in it, then?

mglb added a comment.Oct 16 2019, 7:56 PM

There is no merge commit when it is not necessary, and commits are not usually squashed (at least in Konsole, quick look at Okular says the same), so a MR author should put the keywords in one of the commits. You can check commits on a branch (or in commits tab in merge request) and ask commiter to fix commit descriptions. However, force-push is not allowed in some cases, so that might be impossible (IIRC).

There is yet another problem - the hooks scan ALL branches. When you commit something with "BUG: ..." into your feature branch (and you do it in order to create merge request), the bug is closed automatically. This is worse than skipping the keywords and just closing the bug manually after a merge, because you get spam in a bug and have to reopen it multiple times. See e.g.:. https://bugs.kde.org/show_activity.cgi?id=411965

Btw. Is this task listed somewhere? There are no tags/project assigned to this task. I've found it accidentally via search.

I meant to create this as a sysadmin request; perhaps I failed :/

ngraham closed this task as Invalid.Sep 17 2020, 9:35 PM

Not actually a real issue since the parser acts on commits rather than merge request descriptions, which don't have the problem outlined here.