I don't want to type "git-something", I *know* it's git, everything is git from here on...

I would rather have [rHEX]. So for example, [ra87df3e] would like to commit a87df3e in the "default project" (which can be customized in the settings of the filter. Ideally, you would take that from the context, but I know this is hard to do from filters. If you want to link to another project, you would do [project-rHEX] (e.g. [provision-ra87fd3e]).

The regex would be something like this:

\[(\w+-)?r([0-9a-f]{7}|[0-9a-f]{40})\]

...case-insensitive.

One could argue about the number of hexadecimal characters necessary here. git-rev-parse(1) says it's any substring that's unique to the repository, so we could technically allow any length from 0 to 40. I have chosen to be much more restrictive and allow only the short and long form, and nothing in between, but we could also be more lax and allow:

\[(\w+-)?r([0-9a-f]{7,40})\]

Which would allow any substring between 7 and 40 characters.

Sounds good?

Comments

skwashd’s picture

Version: » 6.x-1.x-dev

Let me know what you think about the latest revision.

rfay’s picture

I find git-project-hash to be "OK" but would rather just type [hash]. How about that?

greggles’s picture

How about [git-project-hash] and make a default project configurable and make default vcs configurable so that [hash] will fallback to the default vcs and project?

steven jones’s picture

So if you need to specify a project, but it has a default per-project (i.e. itself) so you can omit it, what happens when someone moves an issue from one project to another? All the links will break, right?

I don't see why we need to use [git-project-hash] for git, because the hash is effectively a UUID and so the project is extra, unnecessary information. When linking to other issues currently, we don't need to specify the project, just the issue number: [ #number ]

greggles’s picture

I was thinking it would be a default project site-wide.

steven jones’s picture

Right okay, because the git filter doesn't actually have any knowledge of what hashes belong to what projects, I guess that's the best that we could do.
I guess it would be nice to be able to leverage the version control stuff that d.o already has to be able to reference commits and then not need to worry about putting the project in the filter string.