How to link to Git commit?

Added by Joseph S. over 9 years ago

Hi,

I'm having trouble making links to Git commits in issue comments. Earlier, when using Subversion, I was ablo to link to commits by writing rX, where X is the commit number. However, this doesn't seem to work with Git. I tried to paste the entire hash after the r, or part of it, but a link is never made.

Thanks!

Replies (8)

RE: How to link to Git commit? - Added by Felix Schäfer over 9 years ago

As stated in the text formatting help: "Link to a changeset with a non-numeric hash: commit:c6f4d0fd (displays c6f4d0fd)."

RE: How to link to Git commit? - Added by Joseph S. over 9 years ago

Thank you! I should have read the docs more carefully :/

RE: How to link to Git commit? - Added by Toni Mueller over 8 years ago

Felix Schäfer wrote:

As stated in the text formatting help: "Link to a changeset with a non-numeric hash: commit:c6f4d0fd (displays c6f4d0fd)."

Unfortunately, I'm struggling with this as well. I like to use commit:deadbeef to say that the commit is related to a certain issue. But link resolution is spotty at best. I mean, on about 1/3 (?) of all such messages, I get the desired display "deadbeef", which is a link to the commit that I can click and view, but in the other cases, the message just reads "commit:deadbeef" without any linkification.

For me it has been this way on all Redmine versions 1.0.*, but I have not yet detected a pattern what makes it occur or not occur (7-digit short codes, hex/dec. codes, beginning of sentence or line, end of it, ...).

Also, I've never yet experienced that a commit link, once not resolved, would resolve later, or vice versa.

RE: How to link to Git commit? - Added by Felix Schäfer over 8 years ago

Toni Mueller wrote:

Unfortunately, I'm struggling with this as well.

Well, I'm not sure if it works cross-project, you might to check that for the cases with problems. I usually also put commit:thefullhash, so I can't say how good the shorter bits work.

RE: How to link to Git commit? - Added by Toni Mueller over 8 years ago

Felix Schäfer wrote:

Well, I'm not sure if it works cross-project, you might to check that for the cases with problems. I usually also put commit:thefullhash, so I can't say how good the shorter bits work.

Thanks for the answer. Cross-project links could well be the problem, as it seems. Since I can have only one repository per project, but need independent branches for parts of it, also to enhance access control, I created a tree of projects and sub-projects which mostly share a few trackers, and would reference commits from all (sub-) projects in the messages to commits in any one of the (sub-) projects.

Do you see a way around this limitation without opening up everything for everyone, and having everything in one huge (then unmanageable) project?

RE: How to link to Git commit? - Added by Pierre-Louis Bonicoli about 8 years ago

You could specify the project using the following format:

project-identifier:commit:hash

RE: How to link to Git commit? - Added by Toni Mueller about 8 years ago

Thanks, I'll see whether I can use that solution.

RE: How to link to Git commit? - Added by Arnis Juraga over 6 years ago

Felix Schäfer wrote:

Toni Mueller wrote:

Unfortunately, I'm struggling with this as well.

Well, I'm not sure if it works cross-project, you might to check that for the cases with problems. I usually also put commit:thefullhash, so I can't say how good the shorter bits work.

Have a look at this #13000, probably this is the case.

(1-8/8)