Template:Git file/doc: Difference between revisions
[[mw:]]>ENeRZet (text editing) |
ManfredoDo (talk | contribs) m (1 revision imported: Workaround and Utility Templates) |
(No difference)
|
Latest revision as of 17:52, 12 November 2022
This is a documentation subpage for Template:Git file. It contains usage information, categories and other content that is not part of the original Template page. |
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).
See also
- {{git repo}} links to repo summary
- {{gitblit}} generates link to repo summary
- {{MW file}} generates complicated link to file, used by Manual.
- lots of other fancy templates for extensions on gerrit, see Category:Git.
- {{github}}