Template:Git file

From Bonkipedia

{{{file}}}

Template documentation


Usage

Generates a link to view the file in Gerrit.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Labeltext

The text that become the link.

Default
The “file” parameter value.
Stringoptional
Modeaction

One of “browse”, “tree” or “blame” or “history”.

Default
browse
Stringoptional
Repositoryproject

Which Git repository the file is in.

Default
mediawiki/core
Stringoptional
Branchbranch

Which branch of the repository the file is in.

Default
HEAD
Stringoptional
Commitsha

The SHA-1 hash of the specific commit within a branch. Use this to make a permalink.

Stringoptional
Filefile

Path to the file within the specified repository and branch.

Example
includes/MediaWiki.php
Stringrequired
Line numberline

The link will anchor to this line within the file, and highlight it.

Example
42
Numberoptional


Example

Basic

{{Git file|file=composer.json}} produces

composer.json

{{Git file|project=mediawiki/extensions/Flow|file=FlowActions.php}} produces

FlowActions.php
Text

{{Git file|project=mediawiki/extensions/EventLogging|file=devserver/bin/eventlogging-devserver|text=development server}} produces

development server
Action

{{Git file|file=composer.json|action=raw}} {{Git file|file=composer.json|action=blame}} {{Git file|file=composer.json|action=history}} produces

composer.json
composer.json
composer.json

{{Git file|project=mediawiki/extensions/EventLogging|text=EventLogging extension}} produces

EventLogging extension
Line number

{{Git file|file=tests/phpunit/includes/MessageTest.php|line=123}} produces

tests/phpunit/includes/MessageTest.php
Project summary page (deprecated)

{{Git file|project=oojs/core|action=summary|text=OOjs (core)}} produces

OOjs (core)

Known issues

Notes

The template has to use numeric entities &#59; 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