From: Dan Brook Date: Fri, 13 Aug 2010 11:18:11 +0000 (+0100) Subject: Limit the number of branches/tags listed by default. X-Git-Tag: 0.002005~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=535bc6e25cc1d5fd0860af46ec16ee0daea7405d;p=catagits%2FGitalist.git Limit the number of branches/tags listed by default. In the quick branch switch and the summary page the number of branches/tags is now limited to the paging.summary config setting. This way repos with large numbers of refs no longer bog down every page or the overview that is the summary. --- diff --git a/lib/Gitalist/URIStructure/Repository.pm b/lib/Gitalist/URIStructure/Repository.pm index a2c22db..2e142bd 100644 --- a/lib/Gitalist/URIStructure/Repository.pm +++ b/lib/Gitalist/URIStructure/Repository.pm @@ -45,8 +45,8 @@ sub object : Chained('find') PathPart('') Args(1) { sub summary : Chained('find') PathPart('') Args() {} -sub heads : Chained('find') Args(0) {} +sub heads : Chained('find') Args() {} -sub tags : Chained('find') Args(0) {} +sub tags : Chained('find') Args() {} 1; diff --git a/root/fragment/ref/commit.tt2 b/root/fragment/ref/commit.tt2 index 8560e1f..9719b1b 100755 --- a/root/fragment/ref/commit.tt2 +++ b/root/fragment/ref/commit.tt2 @@ -12,12 +12,10 @@ [% INCLUDE 'inc/chroma_hash.tt2' sha1 = Commit.sha1.substr(0, 7) %] [% time_since(Commit.authored_time) %] - - [% Commit.comment | html%] - [% - - INCLUDE '_refs.tt2' object = commit; - %] + [% + message = Commit.comment | html; message.replace("\n", "
"); + INCLUDE '_refs.tt2' object = commit; + %] [% Commit.author.name | html %] Author diff --git a/root/fragment/repository/heads.tt2 b/root/fragment/repository/heads.tt2 index 69c5766..be7b04d 100755 --- a/root/fragment/repository/heads.tt2 +++ b/root/fragment/repository/heads.tt2 @@ -22,6 +22,7 @@ tree + [% LAST IF c.req.args.0 AND c.req.args.0 == loop.count %] [% END %] diff --git a/root/fragment/repository/longlog.tt2 b/root/fragment/repository/longlog.tt2 index 3f11484..3ff258d 100755 --- a/root/fragment/repository/longlog.tt2 +++ b/root/fragment/repository/longlog.tt2 @@ -1,5 +1 @@ [% INCLUDE 'fragment/repository/shortlog.tt2' longlogformat = 1 %] - - -

Branches

-[% subinclude('/fragment/repository/heads', [Repository.name]) %] diff --git a/root/fragment/repository/shortlog.tt2 b/root/fragment/repository/shortlog.tt2 index 0cde010..70ca25e 100755 --- a/root/fragment/repository/shortlog.tt2 +++ b/root/fragment/repository/shortlog.tt2 @@ -42,7 +42,7 @@ - [% c.uri_for_action('/ref/diff_fancy', [Repository.name, 'HEAD']) %] diff --git a/root/repository/summary.tt2 b/root/repository/summary.tt2 index a0646e8..a819455 100755 --- a/root/repository/summary.tt2 +++ b/root/repository/summary.tt2 @@ -6,10 +6,10 @@ [% subinclude('/fragment/repository/shortlog', c.req.captures) %]

Branches

- [% subinclude('/fragment/repository/heads', c.req.captures) %] + [% subinclude('/fragment/repository/heads', c.req.captures, c.config.paging.summary) %] [% IF Repository.tags.size > 0 %]

Tags

- [% subinclude('/fragment/repository/tags', c.req.captures) %] + [% subinclude('/fragment/repository/tags', c.req.captures, c.config.paging.summary) %] [% END %] diff --git a/root/static/js/site.js b/root/static/js/site.js index 076a377..43340d2 100755 --- a/root/static/js/site.js +++ b/root/static/js/site.js @@ -45,8 +45,9 @@ function uriFor(action, sha1) { } function switchBranch() { - var branch = jQuery('#branch-list').val(); - document.location.href = uriFor('current', branch); + var branch = jQuery('#branch-list').val(), + action = branch != '...' ? 'current' : 'heads'; + document.location.href = uriFor(action, branch); } function compareDiffs(){ diff --git a/root/wrapper.tt2 b/root/wrapper.tt2 index c03a4b2..e4a9057 100755 --- a/root/wrapper.tt2 +++ b/root/wrapper.tt2 @@ -63,9 +63,13 @@ Branches @@ -82,11 +86,11 @@ / [%- IF Repository %] [%# FIXME: output branch name in a nicer way!!! #%] - [% FOREACH branch_head IN Repository.heads %] - [% IF c.req.path.search(branch_head.name) %] + [%- FOREACH branch_head IN Repository.heads %] + [%- IF c.req.path.search(branch_head.name) %] [% branch_head.name %] / - [% END %] - [% END %] + [% END -%] + [% END -%] [%- END %] @@ -191,6 +195,7 @@ c.uri_for_action(cur_uri, [Repository.name, 'HEAD']); END; %] +[% c.uri_for_action('/repository/heads', [Repository.name]) %]