Template:Gitweb/doc

From Wikitech

This generates a link to a file on Gerrit.

The goal is to avoid manual URLs like

 https://gerrit.wikimedia.org/g/mediawiki/extensions/examples/+/HEAD/extension.json

and also future-proof against changes and evolution to source code viewers.

Usage

{{Gitweb |project=mediawiki/extensions/examples |file=extension.json }}

produces

extension.json
{{Gitweb |project=mediawiki/extensions/examples |file=extension.json| text=important file }}

produces

important file
{{Gitweb |project=operations/mediawiki-config}}

produces

operations/mediawiki-config

Parameters

project
mandatory. Full name of the Git repository, including any "mediawiki/extensions/" or "operations/" prefix, but without .git suffix.
file
optional. Link to a file within the project, instead of linking to the repository summary page.
text
optional. Link label text. If not specified, defaults to file name or project name.
action
ignored. (Existed in the past for use with Gitweb, but we now use Gitiles.)
branch
optional. The branch in the git repo, default 'master' (unless project=operations/puppet, in which case, default 'production')

TemplateData

Adds link to repo/file

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Projectproject

Project (repo) name

Example
mediawiki/core
Stringrequired
Filefile

File name within repo

Example
doc/README.md
Stringoptional
Link texttext

no description

Stringoptional
Git branch (default 'master')branch

no description

Stringoptional