Difference between revisions 585889 and 605980 on mediawikiwiki

<noinclude>{{Documentation subpage}}
{{timw|{{BASEPAGENAME}}}}
</noinclude>
<!-- PUT HERE THE DOCUMENTATION -->
This generates a link to a file on [[Gerrit]].

The goal is to avoid ugly URLs in wiki text like
  https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/examples.git;f=BoilerPlate/README;hb=HEAD
and also future-proof (ha ha) these links against changes and evolution to source code control, such as swapping gitweb for GitBlit ({{bug|38383}}).

== Usage ==
; basic
 <nowiki>{{git_file</nowiki> |project=mediawiki/extensions/''examples'' |file=''BoilerPlate/README'' }}
produces
:{{git_file|project=mediawiki/extensions/examples|file=BoilerPlate/README }}

; action
 <nowiki>{{git_file</nowiki> |project=mediawiki/extensions/ArticleFeedback 
 |file=modules/jquery.articleFeedback/images/star-new-down.png
 |text=star image | action=blob_plain }}
produces
:{{git_file|project=mediawiki/extensions/ArticleFeedback 
 |file=modules/jquery.articleFeedback/images/star-new-down.png
 |text=star image |action=blob_plain}}

; link to line number, default project
 <nowiki>{{git_file |file=tests/phpunit/includes/IPTest.php |line=123 }}</nowiki>
produces
:{{git_file |file=tests/phpunit/includes/IPTest.php |line=123 }}

; a project (no filename, so use text)
 <nowiki>{{git_file</nowiki> |project=mediawiki/extensions/agora
 |text=Agora extension}}
produces
:{{git_file |project=mediawiki/extensions/Agora |text=Agora extension}}

=== Parameters ===
; project
: defaults to mediawiki/core. Must be entire path to project &mdash; usually mediawiki/ , often followed by extensions/, then your project &mdash; but not the <tt>.git</tt> suffix.
; file
: mandatoryoptional. A file or directory within the project.  If you just want to link to the project, use {{tl|gitweb}}. Note to avoid confusion you may want to invoke this template with underscore &mdash; <code><nowiki>{{git</nowiki>'''_'''file | file=''name''}}</code>.
; text
: optional. The text that's linked.  If not specified, defaults to file.
; action
(contracted; show full)== See also ==
* this replaces Template:GitwebFile that had almost exactly the same functionality (but undocumented and uncategorized so spage missed it)
* {{tl|MW file}} generates complicated link to file, used by [[Manual]]
* lots of other fancy templates for extensions on gerrit, see [[:Category:Git]]
<includeonly>
<!-- PUT HERE THE CATEGORIES OF THE TEMPLATE -->
[[Category:Git]]
</includeonly>