It would be nice to link back to the issue from the cgit page for a commit.

I couldn't find a discussion or issue that discussed why we are not linking back to the issue from the commit message.

Attached is the example cgit commit-links.sh filter adjusted to link to a drupal.org node.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

marvil07’s picture

This sounds like a good idea, here a couple of comments.

  1. s|#([0-9]+)\b|<a href="https://www.drupal.org/node/\1">Issue #\1</a>|g'
    

    Two notes: let's add a boundary character at the start and do not use the string "Issue " in the link, since commit message could contain already that string(so we do not end up with a "Issue Issue #123" link).

  2. sed -re "$regex"
    

    I do not really know how cgit expect this, but this seems to execute the regex defined, which is overridden, so we should have one more sed call before overriding the regex variable, right?

joestewart’s picture

FileSize
1019 bytes

Thanks for looking at it. I quickly attached a file to start discussion. I see the regex wasn't right anyway.

changes attached.

joestewart’s picture

Status: Active » Needs review

1. addressed with starting boundary and Issue.

2. Fellow developer tells me this uses bash concatenation to run both regex lines.

joestewart’s picture

FileSize
558 bytes

patch attached. Didn't know which repo so it is against the cgit repo at http://git.zx2c4.com/cgit/about/

Mixologic’s picture

Issue tags: +Git Repository Viewer
greggles’s picture

Title: cgit: generate links in commit message to issue. » Generate links from commit message to d.o issue

I'm not sure this is still relevant in the long-term vision for our use of gitlab, but at least the title can be cleaned up/clarified a bit.

marvil07’s picture

Component: Git » GitLab
Status: Needs review » Active

It may not be possible to do it just now.
Gitlab support specific trackers, and have a general custom tracker, but it may not be ready for d.o use.

Official gitlab documentation for custom issue trackers seems to not yet support using ids starting only with #, which seems to be reserved for gitlab issue queue.

Back to active, since cgit is not the target anymore, and the suggested configuration is therefore not helping anymore.

FeyP’s picture

It should work just fine. Under "Project" > "Settings" > "Integrations" > "Project services", click on "Custom Issue Tracker".

As URL set https://www.drupal.org/node/:id and the issue ids in commit messages should link back to d.o. Works fine on our own custom GitLab CE instance.

Don't know, if there is a setting to configure this globally, which would be better. Also not sure what happens, if you want to use this in parallel with the internal issue tracker of GitLab.

Mixologic’s picture

I just checked this on our dev instance of gitlab, and it does, indeed work the way we'd like it to, which is great.

However, there are two places to make this settings change 1. on an individual project 2. in the "service templates" section of the main admin screen.

My testing on dev shows that if we add drupal.org as an issue tracker in the service templates section, it will copy that configuration to every project. However, it only does that once, and if we need to make changes to that configuration, we'll have to script a change for all individual projects.

Which means, we probably need to make sure to get it right the first time.

The main thing we need to get correct is what we actually name the service template.

Gitlab will make a link that says "Issue in "

As you can see here: https://drupal:drupal@gitlab1.code-dev.devdrupal.org/project/drupalorg I had named the service "Drupal.org" so we get "Issue in Drupal.org" which is weird.

I had fixed it here:
https://drupal:drupal@gitlab1.code-dev.devdrupal.org/project/drupal/tree...

But Im not sure if thats what we actually want. What should that label actually say?

"Issue in Drupal.org Issue Queue"
"Issue in Drupal.org Issue Queues"
"Issue in issue queues on Drupal.org"

greggles’s picture

Status: Active » Needs review

Needs review for the proposals at the end of #9. I'm fine with any of them personally.

drumm’s picture

“Issue in Drupal.org issue queue”, without title capitalization, works for me.

Mixologic’s picture

Right on. I went ahead and made this change. But It caused a different problem.

Gitlab's docs on this are terrible.
https://docs.gitlab.com/ee/user/project/integrations/custom_issue_tracke...

Says that the project url and new issues url is unused.

It wouldnt let me leave them blank. So I tried:

https://www.drupal.org/project/:project, and apparently :project is not what I should have used.

There is now a 'drupal.org issue tracker' link on the side of the project pages, all of them linking to

https://www.drupal.org/project/:project

*however*. the issue urls now link back to the drupal.org issue properly. I'll close this issue, and open a new one to cleanup the mess.

Mixologic’s picture

Status: Needs review » Fixed
Mixologic’s picture

marvil07’s picture

It is great to hear that it worked, thanks!

And it feels even better to close this old ticket :-)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.