doc
This generates a link to a file in Diffusion (Phabricator).
If this template is not working for a repository, make sure its callsign is listed in Module:Callsigns.
Contents
Usage
- Basic
{{git file |file=composer.json }}
produces
{{git file |project=mediawiki/extensions/Flow |file=FlowActions.php }}
produces
- text
{{git file |project=mediawiki/extensions/EventLogging |file=server/bin/eventlogging-devserver |text=development server }}
produces
- action
{{git file |file=composer.json |action=raw }} {{git file |file=composer.json |action=blame }} {{git file |file=composer.json |action=history }}
produces
- Script error: No such module "callsigns"./browse/master/composer.json?view=raw composer.json
- Script error: No such module "callsigns"./browse/master/composer.json?blame=1 composer.json
- Script error: No such module "callsigns"./history/master/composer.json composer.json
{{git file |project=mediawiki/extensions/EventLogging |text=EventLogging extension |action=tree }}
produces
- line number
{{git file |file=tests/phpunit/includes/MessageTest.php |line=123 }}
produces
- project summary page (deprecated)
{{git file |project=oojs/core |action=summary |text=OOjs (core)}}
produces
^ 2015-08-27 this is actually only working by coincidence, https://phabricator.wikimedia.org/diffusion/GOJS/blahblah/anythingUnrecognized also redirects to the simple https://phabricator.wikimedia.org/diffusion/GOJS/ summary page
Instead use the proper Template:Tl template.
Parameters
- project
- defaults to mediawiki/core. Must be entire path to project — e.g. mediawiki/extensions/EventLogging, not "EventLogging" and without any .git suffix. The template uses Module:Callsigns to map this to a Diffision "callsign", e.g. EEVL.
- branch
- defaults to HEAD, or you can specify e.g.
branch=REL1_25
. TODO: unlike old gitblit URLs, this doesn't work to link to a particular commit. - file
- optional. A file or directory within the project, without the leading '/'. If you just want to link to the project, use Template:Tl. Note to avoid confusion you may want to invoke this template with underscore —
{{git_file | file=name}}
. - text
- optional. The text that's linked. If not specified, defaults to file.
- action
- optional. You can give a Diffusion
view
actionGitblit action, e.g.action=raw
,action=blame
(enables Diffusion "blame mode"),action=history
. Useaction=tree
to link to a directory in the project. Note: Diffusion doesn't support gerrit/gitweb's action blob_plain - line
- optional.
line=42
will add a fragment to the URL that positions the browser at line 42 of the file.
Known issues
- Merge with Template:Tl, or maybe Template:Tl, Template:Tl, etc. but simpler?
Notes
The template has to use numeric entities ;
and &32;
for semicolon and hashmark because, as WP:Advanced template coding says, "MediaWiki wiki-formats the clauses inside #if". MediaWiki would sometimes parse these characters as introducing a definition term and numbered list (even though they're not at the start of new lines!).
See also
- This replaces Template:GitwebFile which had almost exactly the same functionality (but undocumented and uncategorized so pages missed it).
- Template:Tl links to repo summary
- Template:Tl generates link to repo summary
- Template:Tl generates complicated link to file, used by Manual.
- lots of other fancy templates for extensions on gerrit, see Category:Git.
- Template:Tl