project Websites / Gitlab Issue Listing Script avatar

websites/Gitlab-Issue-Listing-Script#30: Show enhanced commit information in issue pages

Issue Information

Issue Type: issue
Status: closed
Reported By: btasker
Assigned To: btasker

Milestone: v0.4
Created: 21-Apr-22 07:26


Currently when a commit references an issue, we display that in the issue page the same way that Gitlab itself does


I've always thought that was a naff approach though - good commit messages convey meaning and should add to the context presented in the issue page.

In JIRA I had a workflow set-up so that the commit message and metadata was written into the issue:


If nothing else it means you're not left duplicating effort by having to add a comment to say something the commit message would already have told you.

I'd like GILS to be capable of displaying something similar when commits reference issues

Issue Links

Toggle State Changes


assigned to @btasker

changed the description

From a coding perspective, it shouldn't be too much of an issue to adjust processing so that we pull full commit information (via getCommit()) for any commit notifications that are detected when preparing to render the page.

On a busy issue, though, that's going to be quite a few extra API calls, so it's got the potential to slow things down.

getCommit() also fetches project details (which we'd already have), so either we need to refactor so that that can be toggled off, or we need to re-prioritise API call caching (#16) to mitigate the latency hit.

At the moment we simply mark commits as being type statechange, the same as issue mentions etc.

Looking at the object gitlab makes available to us at the point that we make that decision:

stdClass Object
    [id] => 1523
    [type] => 
    [body] => mentioned in commit 60fc65e5b9b977c4b2126a10c7da7064bec49f64
    [attachment] => 
    [author] => stdClass Object
            [id] => 3
            [name] => Ben Tasker
            [username] => btasker
            [state] => active
            [avatar_url] =>
            [web_url] =>

    [created_at] => 2022-04-18T09:45:36.420Z
    [updated_at] => 2022-04-18T09:45:36.461Z
    [system] => 1
    [noteable_id] => 220
    [noteable_type] => Issue
    [resolvable] => 
    [confidential] => 
    [noteable_iid] => 20
    [commands_changes] => stdClass Object


There isn't really any way (bar string matching) for us to tell it's a commit notification rather than the issue being assigned etc. System messages tend to be quite short, so the overhead of string matching shouldn't be too bad (although it does mean there's a risk of this feature not working with non-english Gitlab installs).

I'd still like to build this, but I think if we do, it has to be config gated.

Redis support is in place, so this should now be feasible to implement


mentioned in commit 1a4eb98fa153594172113404dcf5fba61b8e075a

Commit: 1a4eb98fa153594172113404dcf5fba61b8e075a 
Author: B Tasker                            
Date: 2022-04-21T19:53:03.000+01:00 


Show enhanced information for commit mentions in issues (websites/Gitlab-Issue-Listing-Script#30)

Rather than just noting a commit has referenced the issue, commit metadata is provided

+62 -6 (68 lines changed)

mentioned in commit ae378a7b833127cdfd0e138d78dbae159fec1969

Commit: ae378a7b833127cdfd0e138d78dbae159fec1969 
Author: B Tasker                            
Date: 2022-04-21T19:55:58.000+01:00 


Handle relative commit references gracefully (websites/Gitlab-Issue-Listing-Script#30)

Where a notification simply says "mentioned in commit aaaaaa" use the current project path

+7 -1 (8 lines changed)

I've implemented a mechanism to show more information


It doesn't currently note whether a commit is signed/verified - we should probably add that too


mentioned in commit 3050c4f71a3622edcdeab022a6bd6d9214fafb23

Commit: 3050c4f71a3622edcdeab022a6bd6d9214fafb23 
Author: B Tasker                            
Date: 2022-04-21T20:04:02.000+01:00 


Add commit signature status to in-issue notifications (websites/Gitlab-Issue-Listing-Script#30)

This'll show the little green badge if the commit is signed by a trusted key

+20 -7 (27 lines changed)

mentioned in commit 1ef5a25a97d4eef35706bbcc10d26200e00d49a1

Commit: 1ef5a25a97d4eef35706bbcc10d26200e00d49a1 
Author: B Tasker                            
Date: 2022-04-21T20:07:45.000+01:00 


Introduce config options to control enhanced commit notifications (websites/Gitlab-Issue-Listing-Script#30)

New options

  • $enhanced_commit_notifications: should enhanced notifications be used (default true)
  • $commit_mention_text: part of the text that Gitlab uses in the system notification. Allows changing for non-english installs
+18 -1 (19 lines changed)

mentioned in issue #32

marked this issue as related to #37

mentioned in issue #41