Template:Git file/doc

Usage

edit

Generates a link to view the file in Gerrit.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Labeltext 2

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 1

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

edit
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

edit

Notes

edit

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

edit
  • {{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.