Page MenuHomePhabricator

Auto-link SHA1 in Gerrit commit messages and comments
Closed, ResolvedPublic

Description

Gerrit has an excellent search system that can find any commit by its SHA1 hash. By default it will redirect from the search to the changeset (merge request), as it does with almost anything, redirects. Which is nice.

Also nice is that when a commit is merged to another branch, searching for the SHA1 hash will show a simple search results list with both changesets that requested a merge of that commit to a certain branch.

Anyway, https://gerrit.wikimedia.org/r/#/c/7265/ mentions 2 SHA1s. Would be nice if those were auto-linked to gerrit's search.

gitweb does link them:

https://gerrit.wikimedia.org/r/gitweb?p=mediawiki%2Fcore.git;a=commit;h=a13e5e2cd087c04294cf6aef8b37ece202847171

Regex: /\b([a-f0-9]{40})\b/
Link: https://gerrit.wikimedia.org/r/#q,$1,n,z

(including the ",n,z" afterwards, not sure why Gerrit needs it, otherwise it doesn't perform the search)


Version: unspecified
Severity: normal

Details

Reference
bz36774

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:30 AM
bzimport added a project: Gerrit.
bzimport set Reference to bz36774.

None of these "auto-linking in gerrit" bugs are +upstream...they're a local configuration change.

Feel free to submit a change in gerrit to the puppet repo. Just need to tweak templates/gerrit/gerrit.config.erb.

change 9109 breaks links like

https://github.com/pediapress/mwlib/commit/4406d53b4c7dcd6cba8b7e5cf7076d08bf754f5c#docs/collection.rst

Filed http://code.google.com/p/gerrit/issues/detail?id=1451 upstream but in fact we should tweak the regular expression a bit. Maybe replace \\b with \\s+ ?

  • Bug 38103 has been marked as a duplicate of this bug. ***

Change-Id: I6f18a716e51bbe7c965b82a4c2716e0ba6ce6a64

(In reply to comment #8)

Re-opening, this is broken again.

See https://gerrit.wikimedia.org/r/#/c/60681/:

d1b4dcd6ac" target="_blank">https://github.com/joyent/node/commit/d1b4dcd6ac

Original text:

https://github.com/joyent/node/commit/d1b4dcd6ac

See bug 38103 instead.

I'm resolving this as FIXED. We've added all the links we wanted (and any new linking can be a new bug). Bug 38103 is for tracking the "links broken when they appear in URLs" thing.