From 89a637660fed90af8991d734ea758a07780e9ac1 Mon Sep 17 00:00:00 2001 From: Eric Sunshine Date: Wed, 14 Jan 2015 02:46:34 -0500 Subject: branch: pass branch name view explicitly Passing the branch name into the view indirectly via Repo.new_in_branch() increases cognitive burden, thus outweighing whatever minor convenience (if any) is gained by doing so. The code is easier to reason about when the branch name is passed to the view directly. Signed-off-by: Eric Sunshine Signed-off-by: Alberto Bertogli --- git-arr | 2 +- views/branch.html | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/git-arr b/git-arr index 15dbf14..a6d6651 100755 --- a/git-arr +++ b/git-arr @@ -263,7 +263,7 @@ def tree(repo, bname, dirname = ''): @bottle.view('branch') @with_utils def branch(repo, bname, offset = 0): - return dict(repo = repo.new_in_branch(bname), offset = offset) + return dict(repo = repo, branch = bname, offset = offset) @bottle.route('/static/') def static(path): diff --git a/views/branch.html b/views/branch.html index 0d3e891..0ca6834 100644 --- a/views/branch.html +++ b/views/branch.html @@ -3,9 +3,9 @@ -% relroot = '../' * (len(repo.branch.split('/')) - 1) +% relroot = '../' * (len(branch.split('/')) - 1) -git » {{repo.name}} » {{repo.branch}} +git » {{repo.name}} » {{branch}} @@ -13,14 +13,14 @@

git » {{repo.name}} » - {{repo.branch}} + {{branch}}

Browse current source tree

-% commits = repo.commits("refs/heads/" + repo.branch, +% commits = repo.commits("refs/heads/" + branch, % limit = repo.info.commits_per_page + 1, % offset = repo.info.commits_per_page * offset) % commits = list(commits) -- cgit v1.2.3