public
Description: Gitorious aims to provide a great way of doing distributed opensource code collaboration.
Homepage: http://gitorious.org/projects/gitorious
Clone URL: git://github.com/dysinger/gitorious.git
Updated repo browser and other git lib related things

- breadcrumbs
- made it work with non-master branches
- made it work when the only branch is a non-master
js (author)
Thu Feb 21 15:32:13 -0800 2008
commit  f28cafd973cb2f3077a1df019cae5e0ab77fb3b6
tree    1ef446fca9eee9ffa4efb0e57cb5ab0ff3f542fa
parent  4fae9ec134454a084959b0f4938474b1dc44715c
...
 
1
2
3
...
1
2
3
4
0
@@ -1,3 +1,4 @@
0
+[ ] Get rid of all the mocking in the controller tests, or at least clean it up
0
 [ ] Nag project owners with no commits to the mainline repos after a week or two
0
 [ ] gitk-style branch view
0
 [ ] project homepage is an editable wiki-ish page
...
6
7
8
9
10
11
 
12
13
14
...
22
23
24
 
 
 
 
25
...
6
7
8
 
 
 
9
10
11
12
...
20
21
22
23
24
25
26
27
0
@@ -6,9 +6,7 @@ class ApplicationController < ActionController::Base
0
   include AuthenticatedSystem
0
   include ExceptionNotifiable
0
   
0
- rescue_from(ActiveRecord::RecordNotFound) do |e|
0
- render :file => "#{RAILS_ROOT}/public/404.html", :status => 404
0
- end
0
+ rescue_from ActiveRecord::RecordNotFound, :with => :render_not_found
0
   
0
   protected
0
     def require_user_has_ssh_keys
0
@@ -22,4 +20,8 @@ class ApplicationController < ActionController::Base
0
     def find_project
0
       @project = Project.find_by_slug!(params[:project_id])
0
     end
0
+
0
+ def render_not_found
0
+ render :file => "#{RAILS_ROOT}/public/404.html", :status => 404
0
+ end
0
 end
...
5
6
7
8
9
10
 
 
11
12
13
...
17
18
19
20
21
 
 
 
 
22
23
24
25
26
 
27
28
29
30
31
32
33
34
 
 
35
36
37
38
 
39
40
41
42
43
44
 
 
 
 
45
46
47
48
49
50
 
 
 
 
 
51
52
53
54
 
55
56
57
 
58
59
60
...
5
6
7
 
 
 
8
9
10
11
12
...
16
17
18
 
 
19
20
21
22
23
24
25
26
 
27
28
 
 
 
 
 
 
 
29
30
31
32
33
 
34
35
36
37
38
 
 
39
40
41
42
43
44
45
 
 
 
46
47
48
49
50
51
52
53
 
54
55
 
 
56
57
58
59
0
@@ -5,9 +5,8 @@ class BrowseController < ApplicationController
0
   LOGS_PER_PAGE = 30
0
   
0
   def index
0
- @git = Gitorious::Gitto.new(@repository.full_repository_path)
0
- @commits = @git.log(LOGS_PER_PAGE)
0
- @tags_per_sha = @git.tags_by_sha
0
+ @git = @repository.git
0
+ @commits = @git.commits(@repository.head_candidate.name, LOGS_PER_PAGE)
0
     # TODO: Patch rails to keep track of what it responds to so we can DRY this up
0
     @atom_auto_discovery_url = project_repository_formatted_browse_path(@project, @repository, :atom)
0
     respond_to do |format|
0
@@ -17,44 +16,44 @@ class BrowseController < ApplicationController
0
   end
0
   
0
   def tree
0
- @git = Gitorious::Gitto.new(@repository.full_repository_path)
0
- @tree = @git.tree(params[:sha])
0
+ @git = @repository.git
0
+ @commit = @git.commit(params[:sha])
0
+ path = params[:path].blank? ? [] : ["#{params[:path].join("/")}/"] # FIXME: meh, this sux
0
+ @tree = @git.tree(@commit.tree.id, path)
0
   end
0
   
0
   def commit
0
     @diffmode = params[:diffmode] == "sidebyside" ? "sidebyside" : "inline"
0
- @git = Gitorious::Gitto.new(@repository.full_repository_path)
0
+ @git = @repository.git
0
     @commit = @git.commit(params[:sha])
0
- if @commit.parent
0
- @diff = @git.diff(@commit.parent.sha || "", @commit.sha)
0
- else
0
- # initial commit, link to the initial tree instead
0
- @diff = nil
0
- end
0
- @comment_count = @repository.comments.count(:all, :conditions => {:sha1 => @commit.sha})
0
+ @diff = @commit.diffs
0
+ @comment_count = @repository.comments.count(:all, :conditions => {:sha1 => @commit.id})
0
   end
0
   
0
   def diff
0
- @git = Gitorious::Gitto.new(@repository.full_repository_path)
0
+ @git = @repository.git
0
     @diff = @git.diff(params[:sha], params[:other_sha])
0
   end
0
   
0
   def blob
0
- @git = Gitorious::Gitto.new(@repository.full_repository_path)
0
- @blob = @git.blob(params[:sha])
0
+ @git = @repository.git
0
+ @commit = @git.commit(params[:sha])
0
+ @blob = @git.tree(@commit.tree.id, ["#{params[:path].join("/")}"]).contents.first
0
+ render_not_found and return unless @blob
0
   end
0
   
0
   def raw
0
- @git = Gitorious::Gitto.new(@repository.full_repository_path)
0
- @blob = @git.blob(params[:sha])
0
- render :text => @blob.contents, :content_type => "text/plain"
0
+ @git = @repository.git
0
+ @commit = @git.commit(params[:sha])
0
+ @blob = @git.tree(@commit.tree.id, ["#{params[:path].join("/")}"]).contents.first
0
+ render_not_found and return unless @blob
0
+ render :text => @blob.data, :content_type => "text/plain"
0
   end
0
   
0
   def log
0
- @git = Gitorious::Gitto.new(@repository.full_repository_path)
0
+ @git = @repository.git
0
     skip = params[:page].blank? ? 0 : (params[:page].to_i-1) * LOGS_PER_PAGE
0
- @commits = @git.log(LOGS_PER_PAGE, skip)
0
- @tags_per_sha = @git.tags_by_sha
0
+ @commits = @git.commits(@repository.head_candidate.name, LOGS_PER_PAGE, skip)
0
     # TODO: Patch rails to keep track of what it responds to so we can DRY this up
0
     @atom_auto_discovery_url = project_repository_formatted_browse_path(@project, @repository, :atom)
0
     respond_to do |format|
...
13
14
15
16
 
17
18
19
...
13
14
15
 
16
17
18
19
0
@@ -13,7 +13,7 @@ class CommentsController < ApplicationController
0
   end
0
   
0
   def commit
0
- @git = Gitorious::Gitto.new(@repository.full_repository_path)
0
+ @git = @repository.git
0
     @commit = @git.commit(params[:sha])
0
     @comments = @repository.comments.find_all_by_sha1(params[:sha], :include => :user)
0
   end
...
13
14
15
16
 
17
18
19
...
13
14
15
 
16
17
18
19
0
@@ -13,7 +13,7 @@ class RepositoriesController < ApplicationController
0
     @repository = @project.repositories.find_by_name!(params[:id])
0
     @comment_count = @repository.comments.count
0
     if @repository.has_commits?
0
- @commits = Gitorious::Gitto.new(@repository.full_repository_path).log(10)
0
+ @commits = @repository.git.commits(@repository.head_candidate.name, 10)
0
     else
0
       @commits = []
0
     end
...
36
37
38
39
40
41
42
43
44
45
46
47
48
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
51
52
...
61
62
63
64
 
65
66
67
68
69
 
70
71
 
72
73
74
75
76
77
 
78
79
80
81
82
83
 
 
84
85
86
...
93
94
95
96
 
97
98
99
100
101
102
 
 
103
104
105
...
36
37
38
 
 
 
 
 
 
 
 
 
 
 
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
...
66
67
68
 
69
70
71
72
73
 
74
75
 
76
77
78
79
80
81
 
82
83
84
85
86
 
 
87
88
89
90
91
...
98
99
100
 
101
102
103
104
105
 
 
106
107
108
109
110
0
@@ -36,17 +36,22 @@ module BrowseHelper
0
     current_path << path
0
   end
0
   
0
- # def breadcrumb_path
0
- # out = %Q{<ul class="path_breadcrumbs">\n}
0
- # visited_path = []
0
- # out << %Q{ <li>/ #{link_to("root", tree_path(params[:sha], []))}</li>\n}
0
- # current_path.each_with_index do |path, index|
0
- # visited_path << path
0
- # out << %Q{ <li>/ #{link_to(path, tree_path(params[:sha], path))}</li>\n}
0
- # end
0
- # out << "</ul>"
0
- # out
0
- # end
0
+ def breadcrumb_path(root_name = "root", commit_id = params[:sha])
0
+ return if current_path.blank?
0
+ out = %Q{<ul class="path_breadcrumbs">\n}
0
+ visited_path = []
0
+ out << %Q{ <li>#{link_to(root_name, tree_path(commit_id, []))}</li>\n}
0
+ current_path.each_with_index do |path, index|
0
+ visited_path << path
0
+ if visited_path == current_path
0
+ out << %Q{ <li>/ #{path}</li>\n}
0
+ else
0
+ out << %Q{ <li>/ #{link_to(path, tree_path(commit_id, visited_path))}</li>\n}
0
+ end
0
+ end
0
+ out << "</ul>"
0
+ out
0
+ end
0
     
0
   def render_tag_box_if_match(sha, tags_per_sha)
0
     tags = tags_per_sha[sha]
0
@@ -61,26 +66,26 @@ module BrowseHelper
0
   end
0
   
0
   # Takes a unified diff as input and renders it as html
0
- def render_diff(udiff, src_sha, dst_sha, display_mode = "inline")
0
+ def render_diff(udiff, display_mode = "inline")
0
     return if udiff.blank?
0
 
0
     case display_mode
0
     when "sidebyside"
0
- render_sidebyside_diff(udiff, src_sha, dst_sha)
0
+ render_sidebyside_diff(udiff)
0
     else
0
- render_inline_diff(udiff, src_sha, dst_sha)
0
+ render_inline_diff(udiff)
0
     end
0
   end
0
   
0
   #diff = Diff::Display::Unified.new(load_diff("simple"))
0
   #diff.render(Diff::Renderer::Base.new)
0
- def render_inline_diff(udiff, src_sha, dst_sha)
0
+ def render_inline_diff(udiff)
0
     differ = Diff::Display::Unified.new(udiff)
0
     out = %Q{<table class="codediff inline">\n}
0
     out << "<thead>\n"
0
     out << "<tr>"
0
- out << %Q{<td class="line-numbers">#{src_sha}</td>}
0
- out << %Q{<td class="line-numbers">#{dst_sha}</td>}
0
+ out << %Q{<td class="line-numbers"></td>}
0
+ out << %Q{<td class="line-numbers"></td>}
0
     out << "<td>&nbsp</td></tr>\n"
0
     out << "</thead>\n"
0
     out << differ.render(Gitorious::Diff::InlineTableCallback.new)
0
@@ -93,13 +98,13 @@ module BrowseHelper
0
     out
0
   end
0
   
0
- def render_sidebyside_diff(udiff, src_sha, dst_sha)
0
+ def render_sidebyside_diff(udiff)
0
     differ = Diff::Display::Unified.new(udiff)
0
     out = %Q{<table class="codediff sidebyside">\n}
0
     out << %Q{<colgroup class="left"><col class="lines"/><col class="code"/></colgroup>}
0
     out << %Q{<colgroup class="right"><col class="lines"/><col class="code"/></colgroup>}
0
- out << %Q{<thead><th class="line-numbers">#{src_sha}</th><th></th>}
0
- out << %Q{<th class="line-numbers">#{dst_sha}</th><th></th></thead>}
0
+ out << %Q{<thead><th class="line-numbers"></th><th></th>}
0
+ out << %Q{<th class="line-numbers"></th><th></th></thead>}
0
     out << differ.render(Gitorious::Diff::SidebysideTableCallback.new)
0
     out << %Q{<tr class="toggle_diff"><td colspan="4">}
0
     out << %Q{<small>#{link_to_function "toggle raw diff", "$('diff#{udiff.object_id}').toggle()"}</small></td></tr>}
...
15
16
17
 
 
18
19
20
...
24
25
26
27
 
 
 
 
 
 
 
 
 
 
 
 
28
29
30
...
42
43
44
45
46
47
48
49
50
51
52
53
54
55
 
 
56
57
58
59
 
 
60
61
62
...
81
82
83
 
 
 
 
 
84
85
86
 
87
88
89
...
15
16
17
18
19
20
21
22
...
26
27
28
 
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
...
55
56
57
 
 
 
 
 
 
 
 
 
 
 
58
59
60
61
62
 
63
64
65
66
67
...
86
87
88
89
90
91
92
93
94
95
 
96
97
98
99
0
@@ -15,6 +15,8 @@ class Repository < ActiveRecord::Base
0
   after_create :add_user_as_committer, :create_new_repos_task
0
   after_destroy :create_delete_repos_task
0
   
0
+ BASE_REPOSITORY_URL = "gitorious.org"
0
+
0
   def self.new_by_cloning(other, username=nil)
0
     suggested_name = username ? "#{username}s-#{other.name}-clone" : nil
0
     new(:parent => other, :project => other.project, :name => suggested_name)
0
@@ -24,7 +26,18 @@ class Repository < ActiveRecord::Base
0
     find_by_name(name) || raise(ActiveRecord::RecordNotFound)
0
   end
0
   
0
- BASE_REPOSITORY_URL = "gitorious.org"
0
+ def self.create_git_repository(path)
0
+ git_backend.create(full_path_from_partial_path(path))
0
+ end
0
+
0
+ def self.clone_git_repository(target_path, source_path)
0
+ git_backend.clone(full_path_from_partial_path(target_path),
0
+ full_path_from_partial_path(source_path))
0
+ end
0
+
0
+ def self.delete_git_repository(path)
0
+ git_backend.delete!(full_path_from_partial_path(path))
0
+ end
0
   
0
   def gitdir
0
     File.join(project.slug, "#{name}.git")
0
@@ -42,21 +55,13 @@ class Repository < ActiveRecord::Base
0
     self.class.full_path_from_partial_path(gitdir)
0
   end
0
   
0
- def self.create_git_repository(path)
0
- git_backend.create(full_path_from_partial_path(path))
0
- end
0
-
0
- def self.clone_git_repository(target_path, source_path)
0
- git_backend.clone(full_path_from_partial_path(target_path),
0
- full_path_from_partial_path(source_path))
0
- end
0
-
0
- def self.delete_git_repository(path)
0
- git_backend.delete!(full_path_from_partial_path(path))
0
+ def git
0
+ Grit::Repo.new(full_repository_path)
0
   end
0
   
0
   def has_commits?
0
- git_backend.repository_has_commits?(full_repository_path)
0
+ return false if new_record? || !ready?
0
+ !git.heads.empty?
0
   end
0
   
0
   def self.git_backend
0
@@ -81,9 +86,14 @@ class Repository < ActiveRecord::Base
0
     end
0
   end
0
   
0
+ def head_candidate
0
+ return nil unless has_commits?
0
+ @head_candidate ||= git.heads.find{|h| h.name == "master"} || git.heads.first
0
+ end
0
+
0
   def last_commit
0
     if has_commits?
0
- @last_commit ||= Git.bare(full_repository_path).log(1).first
0
+ @last_commit ||= git.commits(head_candidate.name, 1).first
0
     end
0
     @last_commit
0
   end
...
1
2
 
3
4
5
6
7
8
9
 
 
 
10
11
...
1
 
2
3
4
5
6
 
 
 
7
8
9
10
11
0
@@ -1,10 +1,10 @@
0
 <ul class="infobox">
0
- <li><strong>Date:</strong> <%=h @commit.date -%></li>
0
+ <li><strong>Date:</strong> <%=h @commit.committed_date -%></li>
0
   <li><strong>Committer:</strong> <%=h @commit.committer.name -%> (<%=h @commit.committer.email -%>)</li>
0
   <% unless @commit.author.email == @commit.committer.email -%>
0
   <li><strong>Author:</strong> <%=h @commit.author.name -%> (<%=h @commit.author.email -%>)</li>
0
   <% end -%>
0
- <li><strong>Commit SHA1:</strong> <%=h @commit.sha -%></li>
0
- <li><strong>Tree SHA1:</strong> <%= link_to h(@commit.gtree.sha),
0
- project_repository_tree_path(@project, @repository, @commit.gtree.sha) -%></li>
0
+ <li><strong>Commit SHA1:</strong> <%=h @commit.id -%></li>
0
+ <li><strong>Tree SHA1:</strong> <%= link_to h(@commit.tree.id),
0
+ project_repository_tree_path(@project, @repository, @commit.id) -%></li>
0
 </ul>
0
\ No newline at end of file
...
1
2
3
4
5
6
 
 
 
7
8
9
...
1
2
3
 
 
 
4
5
6
7
8
9
0
@@ -1,9 +1,9 @@
0
 <ul>
0
 <% @commits.each do |commit| -%>
0
 <li class="commit_item">
0
- <a href=""><%= link_to h(commit.sha)[0,6],
0
- project_repository_commit_path(@project, @repository, commit.sha) -%></a>
0
- by <strong><%=h commit.committer.name -%></strong> <%=h time_ago_in_words(commit.committer.date) -%> ago
0
+ <a href=""><%= link_to h(commit.id_abbrev),
0
+ project_repository_commit_path(@project, @repository, commit.id) -%></a>
0
+ by <strong><%=h commit.committer.name -%></strong> <%=h time_ago_in_words(commit.committed_date) -%> ago
0
   <div class="commit_message"><%= simple_format(h(commit.message)) -%></div>
0
 </li>
0
 <% end -%>
...
12
13
14
15
 
16
17
 
 
18
19
 
20
...
12
13
14
 
15
16
17
18
19
20
 
21
22
0
@@ -12,9 +12,11 @@
0
 
0
 <h1>
0
   Blob of <code><%= current_path.join("/") -%></code>
0
- <small>(<%= link_to "raw blob data", raw_blob_path(@blob.sha, current_path) -%>)</small>
0
+ <small>(<%= link_to "raw blob data", raw_blob_path(@commit.id, current_path) -%>)</small>
0
 </h1>
0
 
0
+<%= breadcrumb_path(@repository.name, @commit.id) -%>
0
+
0
 <% cache do -%>
0
- <%= render_highlighted(@blob.contents, current_path.last || "") -%>
0
+ <%= render_highlighted(@blob.data, current_path.last || "") -%>
0
 <% end -%>
...
1
2
3
 
4
5
6
...
8
9
10
11
 
12
13
14
...
16
17
18
19
 
20
21
22
23
 
24
25
26
27
28
29
 
 
 
 
30
31
32
...
1
2
 
3
4
5
6
...
8
9
10
 
11
12
13
14
...
16
17
18
 
19
20
21
22
 
23
24
25
 
 
 
 
26
27
28
29
30
31
32
0
@@ -1,6 +1,6 @@
0
 <% @page_title = "Commit in #{@repository.name} in #{@project.title}" -%>
0
 
0
-<h1>Commit <%=h @commit.sha -%></h1>
0
+<h1>Commit <%=h @commit.id -%></h1>
0
 
0
 <div class="commit_message"><%= simple_format(h(@commit.message)) -%></div>
0
 <%= render :partial => "commit_infobox" -%>
0
@@ -8,7 +8,7 @@
0
 <ul class="tab_menu">
0
   <li class="selected">Commit diff</li>
0
   <li><%= link_to "Comments (#{@comment_count})",
0
- project_repository_commit_comment_path(@project, @repository, @commit.sha) -%></li>
0
+ project_repository_commit_comment_path(@project, @repository, @commit.id) -%></li>
0
 </ul>
0
 
0
 
0
@@ -16,17 +16,17 @@
0
 <% if @diff.blank? -%>
0
   <p>
0
     This is the initial commit in this repository,
0
- <%= link_to "browse the initial tree state", tree_path(@commit.gtree.sha) -%>.
0
+ <%= link_to "browse the initial tree state", tree_path(@commit.id) -%>.
0
   </p>
0
 <% else -%>
0
 <% cache({:diffmode => @diffmode}) do -%>
0
- <%= render_diff_stats(@diff.stats) -%>
0
+ <%#= render_diff_stats(@diff.stats) -%>
0
   <h2>Commit diff</h2>
0
   <%= render_diffmode_selector -%>
0
- <% @diff.each do |file, index| -%>
0
- <a name="<%= h(file.path) -%>"></a>
0
- <h4><%= h(file.path) -%><%#=link_to h(file.path), blob_path(file.sha, file.path) -%></h4>
0
- <%= render_diff(file.patch, file.src, file.dst, @diffmode) -%>
0
+ <% @diff.each do |file| -%>
0
+ <a name="<%= h(file.a_path) -%>"></a>
0
+ <h4><%=h(file.a_path) -%></h4>
0
+ <%= render_diff(file.diff, @diffmode) -%>
0
   <% end -%>
0
 <% end -%>
0
 <% end -%>
...
1
2
3
 
4
5
6
7
 
 
8
9
10
11
 
 
 
12
13
14
15
16
17
 
18
19
20
...
1
2
 
3
4
5
 
 
6
7
8
 
 
 
9
10
11
12
13
14
15
16
 
17
18
19
20
0
@@ -1,20 +1,20 @@
0
 atom_feed do |feed|
0
   feed.title("Gitorious: #{@project.title} - #{@repository.name}")
0
- feed.updated((@commits.blank? ? nil : @commits.first.date))
0
+ feed.updated((@commits.blank? ? nil : @commits.first.committed_date))
0
 
0
   @commits.each do |commit|
0
- item_url = "http://gitorious.org" + project_repository_commit_path(@project, @repository, commit.sha)
0
- feed.entry(commit.sha, {
0
+ item_url = "http://gitorious.org" + project_repository_commit_path(@project, @repository, commit.id)
0
+ feed.entry(commit.id, {
0
       :url => item_url,
0
- :updated => commit.date,
0
- :published => commit.date,
0
- :id => "#{@repository.name}:#{commit.sha}"
0
+ :updated => commit.committed_date,
0
+ :published => commit.committed_date,
0
+ :id => "#{@repository.name}:#{commit.id}"
0
     }) do |entry|
0
       entry.title(truncate(commit.message, 75))
0
       entry.content(<<-EOS, :type => 'html')
0
 <h1>In #{@repository.gitdir}</h1>
0
 <pre>
0
-Date: #{commit.date.strftime("%Y-%m-%d %H:%M")}
0
+Date: #{commit.committed_date.strftime("%Y-%m-%d %H:%M")}
0
 Committer: #{commit.committer.name} (#{commit.committer.email})
0
 Message:
0
 #{commit.message}
...
6
7
8
9
10
 
 
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
30
31
...
6
7
8
 
 
9
10
11
12
13
14
15
16
 
 
 
 
 
 
 
 
 
 
 
 
 
17
18
19
0
@@ -6,25 +6,13 @@
0
 <ul class="infobox">
0
   <li><strong>Project:</strong> <%= link_to h(@repository.project.title), @repository.project -%></li>
0
   <li><strong>Owner:</strong> <%= link_to h(@repository.user.login), @repository.user -%></li>
0
- <li><strong>HEAD tree:</strong> <%= link_to h(@commits.first.gtree.sha),
0
- tree_path(@commits.first.gtree.sha) -%></li>
0
+ <li><strong>HEAD tree:</strong> <%= link_to h(@commits.first.tree.id),
0
+ tree_path(@commits.id) -%></li>
0
 </ul>
0
 
0
 <h2>Commits</h2>
0
 <%= render :partial => "log", :locals => {:commits => @commits} -%>
0
 
0
 <% content_for :sidebar do -%>
0
- <h5>Branches:</h5>
0
- <ul class="links">
0
- <% @git.branches.each do |branch| -%>
0
- <li><%= link_to h(branch.name), commit_path(branch.gcommit.sha) -%></li>
0
- <% end -%>
0
- </ul>
0
-
0
- <h5>Tags:</h5>
0
- <ul class="links">
0
- <% @git.tags.each do |tag| -%>
0
- <li><%= link_to h(tag.name), commit_path(tag.sha) -%></li>
0
- <% end -%>
0
- </ul>
0
+ <%= render :partial => "tags_and_branches" -%>
0
 <% end -%>
0
\ No newline at end of file
...
9
10
11
12
 
13
14
15
16
17
18
19
 
20
21
22
23
...
9
10
11
 
12
13
14
15
16
17
18
 
19
20
21
22
23
0
@@ -9,14 +9,14 @@
0
   <h5>Branches:</h5>
0
   <ul class="links">
0
     <% @git.branches.each do |branch| -%>
0
- <li><%= link_to h(branch.name), commit_path(branch.gcommit.sha) -%></li>
0
+ <li><%= link_to h(branch.name), commit_path(branch.commit.id) -%></li>
0
     <% end -%>
0
   </ul>
0
 
0
   <h5>Tags:</h5>
0
   <ul class="links">
0
   <% @git.tags.each do |tag| -%>
0
- <li><%= link_to h(tag.name), commit_path(tag.sha) -%></li>
0
+ <li><%= link_to h(tag.name), commit_path(tag.id) -%></li>
0
   <% end -%>
0
   </ul>
0
 <% end -%>
0
\ No newline at end of file
...
1
2
3
 
4
5
 
 
6
7
 
8
9
10
11
12
13
 
 
14
15
16
 
17
18
 
19
20
21
 
 
 
 
22
...
1
2
 
3
4
5
6
7
8
 
9
10
11
 
 
 
 
12
13
14
 
 
15
16
 
17
18
19
20
21
22
23
24
25
0
@@ -1,21 +1,24 @@
0
 <% @page_title = "Tree for #{@repository.name} in #{@project.title}" -%>
0
 <h1>
0
- Browsing tree of <%= h(@repository.name) -%> repository in <%= h(@project.title) -%>
0
+ Tree of <%= h(@repository.name) -%> repository in <%= h(@project.title) -%>
0
 </h1>
0
 
0
+<%= breadcrumb_path(@repository.name, @commit.id) -%>
0
+
0
 <table class="listing tree">
0
- <% @tree.children.sort_by{|f,n| f.downcase }.each do |file, node| -%>
0
+ <% @tree.contents.sort_by{|c| c.name.downcase}.each do |node| -%>
0
   <tr class="<%= cycle("odd", "even") -%>">
0
     <!-- <td><%#= h(node.mode) -%></td> -->
0
- <% if node.type == "tree" -%>
0
- <td class="node tree"><%= link_to h(file + "/"), tree_path(node.sha, build_tree_path(file)) -%></td>
0
- <td class="link"><%= link_to node.type, tree_path(node.sha, build_tree_path(file)) -%></td>
0
- <!-- TODO: archive -->
0
+ <% if node.is_a? Grit::Tree -%>
0
+ <td class="node tree"><%= link_to h(node.basename) + "/", tree_path(@commit.id, node.name) -%></td>
0
     <% else -%>
0
- <td class="node file"><%= link_to h(file), blob_path(node.sha, build_tree_path(file)) -%></td>
0
- <td class="link"><%= link_to node.type, blob_path(node.sha, build_tree_path(file)) -%></td>
0
+ <td class="node file"><%= link_to h(node.basename), blob_path(@commit.id, node.name) -%></td>
0
     <% end -%>
0
- <td class="sha1"><%= h(node.sha[0..16]) -%></td>
0
+ <td></td>
0
   </tr>
0
   <% end -%>
0
 </table>
0
+
0
+<% content_for :sidebar do -%>
0
+ <%= render :partial => "tags_and_branches" -%>
0
+<% end -%>
0
\ No newline at end of file
...
5
6
7
8
 
9
10
11
...
5
6
7
 
8
9
10
11
0
@@ -5,7 +5,7 @@
0
     <%= link_to(h(comment.user.login), comment.user) -%> |
0
     <%= comment.created_at.to_s(:short) -%>
0
     <% unless comment.sha1.blank? -%>
0
- | <%= link_to "on commit #{comment.sha1[0..8]}", project_repository_commit_path(@project, @repository, comment.sha1) -%>
0
+ | <%= link_to "on commit #{comment.sha1[0..7]}", project_repository_commit_path(@project, @repository, comment.sha1) -%>
0
     <% end -%>
0
     | <a href="#<%= dom_id(comment) -%>"><abbr title="permalink for this comment">#</abbr></a>
0
   </p>
...
1
2
 
3
4
5
...
7
8
9
10
 
11
12
13
14
15
16
 
...
1
 
2
3
4
5
...
7
8
9
 
10
11
12
13
14
15
 
16
0
@@ -1,5 +1,5 @@
0
 <% @page_title = "Comments in #{@repository.name}" -%>
0
-<h1>Comments on commit <%= h(@commit.sha) -%> in <%= h(@repository.name) -%></h1>
0
+<h1>Comments on commit <%= h(@commit.id[0,7]) -%> in <%= h(@repository.name) -%></h1>
0
 
0
 <p><pre><%=h @commit.message -%></pre></p>
0
 
0
@@ -7,10 +7,10 @@
0
 
0
 <ul class="tab_menu">
0
   <li><%= link_to "Commit diff",
0
- project_repository_commit_path(@project, @repository, @commit.sha) -%></li>
0
+ project_repository_commit_path(@project, @repository, @commit.id) -%></li>
0
   <li class="selected">Comments (<%= @comments.size -%>)</li>
0
 </ul>
0
 
0
 <%= render :partial => @comments -%>
0
 
0
-<%= render :partial => "form", :locals => {:sha1 => @commit.sha} -%>
0
+<%= render :partial => "form", :locals => {:sha1 => @commit.id} -%>
...
60
61
62
63
 
 
 
64
65
66
...
60
61
62
 
63
64
65
66
67
68
0
@@ -60,7 +60,9 @@
0
             <%= link_to "Commits", project_repository_browse_path(@project, @repository) -%>
0
           </li>
0
           <li class="<%= selected_if_current_page(project_repository_tree_path(@project, @repository)) -%>">
0
- <%= link_to "HEAD Tree", project_repository_tree_path(@project, @repository, "HEAD") -%>
0
+ <% if @repository.head_candidate -%>
0
+ <%= link_to "Source Tree", project_repository_tree_path(@project, @repository, @repository.head_candidate.name) -%>
0
+ <% end -%>
0
           </li>
0
           <!-- <li class="<%= selected_if_current_page(project_repository_comments_path(@project, @repository)) -%>">
0
             <%= link_to "Comments", project_repository_comments_path(@project, @repository) -%>
...
41
42
43
44
 
45
46
47
...
55
56
57
58
 
59
60
61
...
41
42
43
 
44
45
46
47
...
55
56
57
 
58
59
60
61
0
@@ -41,7 +41,7 @@
0
           <%= h(@project.slug) -%> (<%= link_to h(repos.user.login), user_path(repos.user) -%>)
0
         </td>
0
         <td>
0
- <%= repos.last_commit ? repos.last_commit.committer.date.to_s(:short) : "<em>none</em>" -%>
0
+ <%= repos.last_commit ? repos.last_commit.committed_date.to_s(:short) : "<em>none</em>" -%></