Allow requesting badges for branches != master
This changed the cache structure to allow caching data for multiple branches. The service still assumes a default branch named `master` but using the `branch` get parameter, the default branch can be changed. The 404 page for the missing `master` branch was changed to explain the new parameter.
This commit is contained in:
@ -45,6 +45,12 @@ would render this badge:
|
||||
alt="example badge" /></a>
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
By default, this service assumes the existence of a branch named <code>master</code>. If no branch with that name exists
|
||||
in your repository or you want a badge for another branch of your repository, just append
|
||||
<code>?branch=<branch-name></code> to the URL.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
You can also request the HoC as JSON by appending <code>/json</code> to the request path. This will return a JSON object
|
||||
with three fields: <code>count</code> (the HoC value), <code>commits</code> (the number of commits) and
|
||||
|
@ -9,7 +9,8 @@
|
||||
<p>
|
||||
The project <a href="@repo_info.url">@repo_info.url</a> has
|
||||
<strong>@repo_info.hoc_pretty</strong> (exactly @repo_info.hoc) hits of code at
|
||||
<a href="@repo_info.commit_url">@repo_info.head</a>. The repository contains
|
||||
<a href="@repo_info.commit_url">@repo_info.head</a> on the
|
||||
<code>@repo_info.branch</code> branch. The repository contains
|
||||
<strong>@repo_info.commits</strong> commits.
|
||||
</p>
|
||||
|
||||
@ -18,7 +19,7 @@ To include the badge in your readme, use the following markdown:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
[](https://@repo_info.domain/view/@repo_info.path)
|
||||
[](https://@repo_info.domain/view/@repo_info.path?branch=@repo_info.branch)
|
||||
</pre>
|
||||
|
||||
|
||||
|
@ -3,11 +3,11 @@
|
||||
|
||||
@(version_info: VersionInfo, repo_count: usize)
|
||||
|
||||
@:base("Master Branch not Found - Hits-of-Code Badges", "404 - Master Branch not Found", {
|
||||
@:base("Branch not Found - Hits-of-Code Badges", "404 - Branch not Found", {
|
||||
<p>
|
||||
<big>Sorry</big>. I couldn't find the master branch of your repositroy.
|
||||
Currently this service depends on the existence of a master branch. Please go
|
||||
<a href="/">back to the homepage</a>.
|
||||
<big>Sorry</big>. I couldn't find the requested branch of your repositroy. Currently this service assumes the
|
||||
extistence of a branch named <code>master</code>. If you'd like to request a badge for another branch, you can do so by
|
||||
attaching <code>?branch=<branch-name></code> to the request.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
Reference in New Issue
Block a user