Correctly support branch names with slashes

Previously, branches with slashes in the name would consume all slashed
segments in a URL, causing the routes to capture incorrect file paths.

This solution is not particularly elegant - anywhere a route used
both a commit-ish identifier and a path, we collapse those two params
into a single param, and parse that param inside the route.

It seems to be working reasonably reliably, but has not seen extensive
testing.

It is also not particularly pretty. If anyone sees ways to improve it,
please, have at it.
This commit is contained in:
Nate Eagleson
2013-02-08 18:48:06 -05:00
parent ab7ffc181b
commit 421574b5a9
11 changed files with 167 additions and 36 deletions

View File

@@ -30,8 +30,8 @@
<div class="meta"><a name="{{ loop.index }}">{{ diff.file }}</div>
<div class="btn-group pull-right">
<a href="{{ path('commits', {repo: repo, branch: commit.hash, file: diff.file}) }}" class="btn btn-small"><i class="icon-list-alt"></i> History</a>
<a href="{{ path('blob', {repo: repo, branch: commit.hash, file: diff.file}) }}" class="btn btn-small"><i class="icon-file"></i> View file @ {{ commit.shortHash }}</a>
<a href="{{ path('commits', {repo: repo, commitish_path: commit.hash ~ '/' ~ diff.file}) }}" class="btn btn-small"><i class="icon-list-alt"></i> History</a>
<a href="{{ path('blob', {repo: repo, commitish_path: commit.hash ~'/' ~ diff.file}) }}" class="btn btn-small"><i class="icon-file"></i> View file @ {{ commit.shortHash }}</a>
</div>
</div>