Template:Git file
Usage
Generates a link to view the file in Gerrit.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Label | text | The text that become the link.
| String | optional |
Mode | action | One of “browse”, “tree” or “blame” or “history”.
| String | optional |
Repository | project | Which Git repository the file is in.
| String | optional |
Branch | branch | Which branch of the repository the file is in.
| String | optional |
Commit | sha | The SHA-1 hash of the specific commit within a branch. Use this to make a permalink. | String | optional |
File | file | Path to the file within the specified repository and branch.
| String | required |
Line number | line | The link will anchor to this line within the file, and highlight it.
| Number | optional |
Example
- 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=devserver/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
{{Git file|project=mediawiki/extensions/EventLogging|text=EventLogging extension}} 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
Known issues
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).