Template:Git file
[[git:mediawiki/core/+/HEAD/|]]
Usage
Generates a link to view the file in Gerrit.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Label | text 2 | 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 1 | 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).
See also
- {{Git repo }} links to a repository summary
- {{MW file }} generates a box with various links to a file in MediaWiki core, used by Manual.
- {{Git }} generates links to various git-related objects on gerrit, like commits or changesets
- {{Github }} links to a file on the GitHub mirror of a repository (by default wikimedia/mediawiki)
- lots of other fancy templates for extensions on gerrit, see Category:Git.