Difference between revisions of "Template:Git link"

From VideoLAN Wiki
Jump to navigation Jump to search
m (In examples, commit [72f3067a6fddcd30e0ee33928a0ec6622ed2e74b] is the first revision of VLC)
m (Change examples: you can link to removed modules (with some effort), remove useless example, explain other example)
Line 103: Line 103:
 
  <code>{{{{PAGENAME}}<nowiki>|p=x264.git|a=history}}</nowiki></code>
 
  <code>{{{{PAGENAME}}<nowiki>|p=x264.git|a=history}}</nowiki></code>
 
{{{{PAGENAME}}|p=x264.git|a=history}}
 
{{{{PAGENAME}}|p=x264.git|a=history}}
 +
 +
Example 6:
 +
<code>{{{{PAGENAME}}<nowiki>|p=vlc/vlc-2.0.git|a=blob|f=modules/video_filter/crop.c|h=b5e946097a7e7acbe0c90446d0752ff0f7f706ec|hb=HEAD|l=This module no longer exists. Here's a link to it anyway}}</nowiki></code>
 +
{{{{PAGENAME}}|p=vlc/vlc-2.0.git|a=blob|f=modules/video_filter/crop.c|h=b5e946097a7e7acbe0c90446d0752ff0f7f706ec|hb=HEAD|l=This module no longer exists. Here's a link to it anyway}}
  
 
This template will branch intelligently if any parameter or combination of parameters are omitted, because raw parameters send [[wikipedia:XSS|XSS]] requests:
 
This template will branch intelligently if any parameter or combination of parameters are omitted, because raw parameters send [[wikipedia:XSS|XSS]] requests:
 
* <code>{{{{PAGENAME}}<nowiki>}}</nowiki></code> gives {{{{PAGENAME}}<!---->}}
 
* <code>{{{{PAGENAME}}<nowiki>}}</nowiki></code> gives {{{{PAGENAME}}<!---->}}
* <code>{{{{PAGENAME}}|p=vlc.git<nowiki>}}</nowiki></code> gives {{{{PAGENAME}}|p=vlc.git}}
+
* <code>{{{{PAGENAME}}|a=blob|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b<nowiki>}}</nowiki></code> gives {{{{PAGENAME}}|a=blob|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b}} because no branch was specified
* <code>{{{{PAGENAME}}|a=blob|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b<nowiki>}}</nowiki></code> gives {{{{PAGENAME}}|a=blob|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b}}
 
  
 
[[Category:Templates]]
 
[[Category:Templates]]
 
</noinclude>
 
</noinclude>

Revision as of 03:05, 12 March 2019

Git

Usage

{{ Git link |p= |a= |h= }}

or

{{ Git link |p= |a= |h= |l= }}

or

{{ Git link |p= |a= |f= }}

or

{{ Git link |p= |a= |f= |h= }}

This is a meta-template.

Parameters:

  • |p= is the branch e.g. vlc.git, vlc/vlc-2.2.git or vlma.git (see https://git.videolan.org for a list of branch names)
  • |a= is the format e.g. blob. No sanity checks are done by this template but only summary, shortlog, log, commit, commitdiff, tree and patch are valid.
  • |f= is the file e.g. modules/demux/image.c. You can pass directory names to |f= as well if |a=tree
  • |h= is the hash e.g. 72f3067a6fddcd30e0ee33928a0ec6622ed2e74b
  • |hb= ???
  • |l= is the label (optional) e.g. arbitrary

Example 1:

{{Git link|p=vlc.git|a=commit|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b}}

[72f3067a6fddcd30e0ee33928a0ec6622ed2e74b]

Example 2:

{{Git link|p=vlc.git|a=commit|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b|l=First revision of VLC}}

First revision of VLC

Example 3:

{{Git link|p=x264.git|a=tree|f=modules}}

modules

Example 4:

{{Git link|p=vlc.git|a=commitdiff|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b}}

[72f3067a6fddcd30e0ee33928a0ec6622ed2e74b]

Example 5:

{{Git link|p=x264.git|a=history}}

x264.git

Example 6:

{{Git link|p=vlc/vlc-2.0.git|a=blob|f=modules/video_filter/crop.c|h=b5e946097a7e7acbe0c90446d0752ff0f7f706ec|hb=HEAD|l=This module no longer exists. Here's a link to it anyway}}

This module no longer exists. Here's a link to it anyway

This template will branch intelligently if any parameter or combination of parameters are omitted, because raw parameters send XSS requests:

  • {{Git link}} gives Git
  • {{Git link|a=blob|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b}} gives Git because no branch was specified