libdolt 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +0 -3
- data/Gemfile.lock +1 -1
- data/lib/libdolt/version.rb +1 -1
- data/libdolt.gemspec +1 -1
- data/test/fixtures/dolt-test-repo.git/objects/12/67a0fbd3ec606c20f3f1dca1f53bb9505ba9b5 +0 -0
- data/test/fixtures/dolt-test-repo.git/objects/60/eebb9021a6ce7d582c2f2d4aa5bfb3672150ae +2 -0
- data/test/fixtures/dolt-test-repo.git/objects/c0/35ba24bb3bed31589bc6736ca9b116175eb723 +0 -0
- data/test/fixtures/dolt-test-repo.git/objects/c8/cc83f1a1fc3640fce14ab73d4fa4b22b6211d8 +0 -0
- data/test/fixtures/dolt-test-repo.git/objects/de/dbf2faa4f522716ab727e4325a3d75772e137b +0 -0
- data/test/fixtures/dolt-test-repo.git/objects/e8/d33ae69b8c4d3df1e8fad4733d69720b176849 +1 -0
- data/test/fixtures/dolt-test-repo.git/objects/e9/0021f89616ddf86855d05337c188408d3b417e +0 -0
- data/test/fixtures/dolt-test-repo.git/refs/heads/master +1 -1
- data/test/libdolt/git/repository_test.rb +41 -34
- data/test/libdolt/repo_actions_test.rb +1 -2
- data/test/test_helper.rb +7 -0
- data/views/404.erb +8 -2
- data/views/blob.erb +1 -1
- data/views/tree.erb +1 -1
- metadata +13 -6
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/lib/libdolt/version.rb
CHANGED
data/libdolt.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
|
23
23
|
s.add_development_dependency "minitest", "~> 2.0"
|
24
24
|
s.add_development_dependency "rake", "~> 0.9"
|
25
|
-
s.add_development_dependency "redcarpet", "2.2
|
25
|
+
s.add_development_dependency "redcarpet", "~> 2.2"
|
26
26
|
s.add_development_dependency "tiltout", "~>1.4"
|
27
27
|
s.add_development_dependency "mocha"
|
28
28
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
x���J1�a�}��$MMg�&x�
|
Binary file
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
e8d33ae69b8c4d3df1e8fad4733d69720b176849
|
@@ -22,31 +22,31 @@ require "ostruct"
|
|
22
22
|
require "mocha/setup"
|
23
23
|
|
24
24
|
describe Dolt::Git::Repository do
|
25
|
-
before { @repository = Dolt::Git::Repository.new(
|
25
|
+
before { @repository = Dolt::Git::Repository.new(Dolt.fixture_repo_path) }
|
26
26
|
|
27
27
|
describe "#submodules" do
|
28
28
|
it "returns list of submodules" do
|
29
|
-
submodules = @repository.submodules("
|
29
|
+
submodules = @repository.submodules("60eebb9")
|
30
30
|
url = "git://gitorious.org/gitorious/ui3.git"
|
31
31
|
|
32
32
|
assert_equal [{ :path => "vendor/ui", :url => url }], submodules
|
33
33
|
end
|
34
34
|
|
35
35
|
it "returns empty array if no submodules" do
|
36
|
-
submodules = @repository.submodules("
|
36
|
+
submodules = @repository.submodules("fc5f5fb")
|
37
37
|
assert_equal [], submodules
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
describe "#tree" do
|
42
42
|
it "includes submodule data for trees" do
|
43
|
-
tree = @repository.tree("
|
43
|
+
tree = @repository.tree("60eebb9", "vendor")
|
44
44
|
|
45
45
|
assert_equal({
|
46
46
|
:type => :submodule,
|
47
47
|
:filemode => 57344,
|
48
48
|
:name => "ui",
|
49
|
-
:oid => "
|
49
|
+
:oid => "77c88454e83e59772e9bf460ef22251cc9d63f9f",
|
50
50
|
:url => "git://gitorious.org/gitorious/ui3.git"
|
51
51
|
}, tree.entries.first)
|
52
52
|
end
|
@@ -54,82 +54,89 @@ describe Dolt::Git::Repository do
|
|
54
54
|
|
55
55
|
describe "#tree_entry" do
|
56
56
|
it "includes submodule data for trees" do
|
57
|
-
tree = @repository.tree_entry("
|
57
|
+
tree = @repository.tree_entry("60eebb9", "vendor")
|
58
58
|
|
59
59
|
assert_equal({
|
60
60
|
:type => :submodule,
|
61
61
|
:filemode => 57344,
|
62
62
|
:name => "ui",
|
63
|
-
:oid => "
|
63
|
+
:oid => "77c88454e83e59772e9bf460ef22251cc9d63f9f",
|
64
64
|
:url => "git://gitorious.org/gitorious/ui3.git"
|
65
65
|
}, tree.entries.first)
|
66
66
|
end
|
67
67
|
|
68
68
|
it "returns blob" do
|
69
|
-
blob = @repository.tree_entry("
|
69
|
+
blob = @repository.tree_entry("fc5f5fb", "README.org")
|
70
70
|
|
71
71
|
assert blob.is_a?(Rugged::Blob)
|
72
|
-
assert_equal "
|
72
|
+
assert_equal "* This is a readme\n It even has some text in it\n", blob.content
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
76
|
describe "#blame" do
|
77
77
|
it "returns blame" do
|
78
|
-
blame = @repository.blame("master", "
|
78
|
+
blame = @repository.blame("master", "README.org")
|
79
79
|
assert Dolt::Git::Blame === blame
|
80
80
|
end
|
81
81
|
|
82
82
|
it "separates tree-like and path" do
|
83
|
-
cmd = "git --git-dir #{@repository.path} blame -l -t -p master --
|
83
|
+
cmd = "git --git-dir #{@repository.path} blame -l -t -p master -- README.org"
|
84
84
|
Dolt::Git.expects(:shell).with(cmd).returns(Dolt::FakeProcess.new(0))
|
85
|
-
@repository.blame("master", "
|
85
|
+
@repository.blame("master", "README.org")
|
86
86
|
end
|
87
87
|
|
88
88
|
it "does not allow injecting evil commands" do
|
89
|
-
cmd = "git --git-dir #{@repository.path} blame -l -t -p master --
|
89
|
+
cmd = "git --git-dir #{@repository.path} blame -l -t -p master -- README.org\\; rm -fr /tmp"
|
90
90
|
Dolt::Git.expects(:shell).with(cmd).returns(Dolt::FakeProcess.new(0))
|
91
|
-
@repository.blame("master", "
|
91
|
+
@repository.blame("master", "README.org; rm -fr /tmp")
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
95
|
describe "#log" do
|
96
96
|
it "returns commits" do
|
97
|
-
log = @repository.log("master", "
|
97
|
+
log = @repository.log("master", "README.org", 2)
|
98
98
|
assert_equal 2, log.length
|
99
99
|
assert Hash === log[0]
|
100
|
+
|
101
|
+
log = @repository.log("master", "README.org", 1)
|
102
|
+
assert_equal 1, log.length
|
100
103
|
end
|
101
104
|
end
|
102
105
|
|
103
106
|
describe "#tree_history" do
|
104
107
|
it "fails if path is not a tree" do
|
105
|
-
|
106
|
-
tree = @repository.tree_history("master", "
|
108
|
+
begin
|
109
|
+
tree = @repository.tree_history("master", "README.org")
|
110
|
+
raise "Should've raised an Exception"
|
111
|
+
rescue Exception => err
|
107
112
|
assert_match /not a tree/, err.message
|
108
113
|
end
|
109
114
|
end
|
110
115
|
|
111
116
|
it "fails if path does not exist in ref" do
|
112
|
-
|
113
|
-
tree = @repository.tree_history("
|
117
|
+
begin
|
118
|
+
tree = @repository.tree_history("fc5f5fb", "test")
|
119
|
+
raise "Should've raised an Rugged::IndexerError"
|
120
|
+
rescue Rugged::IndexerError => err
|
114
121
|
assert_match /does not exist/, err.message
|
115
122
|
end
|
116
123
|
end
|
117
124
|
|
118
125
|
it "returns tree with history" do
|
119
|
-
log = @repository.tree_history("
|
126
|
+
log = @repository.tree_history("e8d33ae", "")
|
120
127
|
|
121
|
-
assert_equal
|
128
|
+
assert_equal 4, log.length
|
122
129
|
expected = {
|
123
130
|
:type => :blob,
|
124
131
|
:oid => "e90021f89616ddf86855d05337c188408d3b417e",
|
125
132
|
:filemode => 33188,
|
126
133
|
:name => ".gitmodules",
|
127
134
|
:history => [{
|
128
|
-
:oid => "
|
135
|
+
:oid => "60eebb9021a6ce7d582c2f2d4aa5bfb3672150ae",
|
129
136
|
:author => { :name => "Christian Johansen",
|
130
137
|
:email => "christian@cjohansen.no" },
|
131
|
-
:summary => "
|
132
|
-
:date => Time.parse("
|
138
|
+
:summary => "Add submodule",
|
139
|
+
:date => Time.parse("Tue Jun 18 09:01:48 +0200 2013"),
|
133
140
|
:message => ""
|
134
141
|
}]
|
135
142
|
}
|
@@ -138,19 +145,19 @@ describe Dolt::Git::Repository do
|
|
138
145
|
end
|
139
146
|
|
140
147
|
it "returns nested tree with history" do
|
141
|
-
log = @repository.tree_history("
|
148
|
+
log = @repository.tree_history("e8d33ae", "lib")
|
142
149
|
|
143
150
|
expected = [{
|
144
|
-
:type => :
|
145
|
-
:oid => "
|
146
|
-
:filemode =>
|
147
|
-
:name => "
|
151
|
+
:type => :blob,
|
152
|
+
:oid => "85026eda8302b98fa54cc24445a118028865a2e2",
|
153
|
+
:filemode => 33188,
|
154
|
+
:name => "foo.rb",
|
148
155
|
:history => [{
|
149
|
-
:oid => "
|
150
|
-
:author => { :name => "
|
151
|
-
:email => "
|
152
|
-
:summary => "
|
153
|
-
:date => Time.parse("
|
156
|
+
:oid => "fc5f5fb50b435e183925b341909610aace90a413",
|
157
|
+
:author => { :name => "Marius Mathiesen",
|
158
|
+
:email => "marius@gitorious.com" },
|
159
|
+
:summary => "Stuff and stuff",
|
160
|
+
:date => Time.parse("Tue Jun 11 13:10:31 +0200 2013"),
|
154
161
|
:message => ""
|
155
162
|
}]
|
156
163
|
}]
|
@@ -25,8 +25,7 @@ class Resolver
|
|
25
25
|
def initialize; @resolved = []; end
|
26
26
|
|
27
27
|
def resolve(repo)
|
28
|
-
|
29
|
-
repository = Dolt::Git::Repository.new(dot_git)
|
28
|
+
repository = Dolt::Git::Repository.new(Dolt.fixture_repo_path)
|
30
29
|
@resolved << repository
|
31
30
|
repository
|
32
31
|
end
|
data/test/test_helper.rb
CHANGED
@@ -23,7 +23,14 @@ require "stringio"
|
|
23
23
|
|
24
24
|
Bundler.require(:default, :test)
|
25
25
|
|
26
|
+
# Ensure consistent timing
|
27
|
+
ENV["TZ"] = "UTC-2"
|
28
|
+
|
26
29
|
module Dolt
|
30
|
+
def self.fixture_repo_path
|
31
|
+
File.join(File.dirname(__FILE__), "fixtures/dolt-test-repo.git")
|
32
|
+
end
|
33
|
+
|
27
34
|
module Html
|
28
35
|
def select(html, tag_name)
|
29
36
|
html.scan(/<#{tag_name}[^>]*>.*?<\/#{tag_name}>/m)
|
data/views/404.erb
CHANGED
@@ -19,6 +19,12 @@
|
|
19
19
|
%>
|
20
20
|
<div class="container gts-body">
|
21
21
|
<h1><%= @title = "No such path" %></h1>
|
22
|
-
|
23
|
-
|
22
|
+
<% if defined?(error) && !error.nil? %>
|
23
|
+
<h2><%= CGI::escapeElement(error.respond_to?(:message) ? error.message : error).gsub(/</, "<") %></h2>
|
24
|
+
<% end %>
|
25
|
+
<% if defined?(repository_slug) %>
|
26
|
+
<p><a href="<%= tree_url(repository_slug, ref, "") %>">Go back</a></p>
|
27
|
+
<% else %>
|
28
|
+
<p><a href="/">Go back</a></p>
|
29
|
+
<% end %>
|
24
30
|
</div>
|
data/views/blob.erb
CHANGED
@@ -28,6 +28,6 @@
|
|
28
28
|
<li><a href="<%= raw_url(repository_slug, ref, path) %>">Raw blob</a></li>
|
29
29
|
</ul>
|
30
30
|
<%= breadcrumb(repository_slug, ref, path) %>
|
31
|
-
<%= format_blob(path, blob.text(nil, Encoding.default_external), repository_slug, ref) %>
|
31
|
+
<%= format_blob(path, blob.text(nil, defined?(Encoding) ? Encoding.default_external : nil), repository_slug, ref) %>
|
32
32
|
</div>
|
33
33
|
</div>
|
data/views/tree.erb
CHANGED
@@ -54,7 +54,7 @@
|
|
54
54
|
<div class="gts-page-header">
|
55
55
|
<h2><%= readme[:path] %></h2>
|
56
56
|
</div>
|
57
|
-
<%= format_blob(readme[:path], readme[:blob].text(nil, Encoding.default_external), repository_slug, ref) %>
|
57
|
+
<%= format_blob(readme[:path], readme[:blob].text(nil, defined?(Encoding) ? Encoding.default_external : nil), repository_slug, ref) %>
|
58
58
|
</div>
|
59
59
|
<% end %>
|
60
60
|
</div>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libdolt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.21.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rugged
|
@@ -144,17 +144,17 @@ dependencies:
|
|
144
144
|
requirement: !ruby/object:Gem::Requirement
|
145
145
|
none: false
|
146
146
|
requirements:
|
147
|
-
- -
|
147
|
+
- - ~>
|
148
148
|
- !ruby/object:Gem::Version
|
149
|
-
version: 2.2
|
149
|
+
version: '2.2'
|
150
150
|
type: :development
|
151
151
|
prerelease: false
|
152
152
|
version_requirements: !ruby/object:Gem::Requirement
|
153
153
|
none: false
|
154
154
|
requirements:
|
155
|
-
- -
|
155
|
+
- - ~>
|
156
156
|
- !ruby/object:Gem::Version
|
157
|
-
version: 2.2
|
157
|
+
version: '2.2'
|
158
158
|
- !ruby/object:Gem::Dependency
|
159
159
|
name: tiltout
|
160
160
|
requirement: !ruby/object:Gem::Requirement
|
@@ -234,10 +234,17 @@ files:
|
|
234
234
|
- test/fixtures/dolt-test-repo.git/config
|
235
235
|
- test/fixtures/dolt-test-repo.git/description
|
236
236
|
- test/fixtures/dolt-test-repo.git/info/exclude
|
237
|
+
- test/fixtures/dolt-test-repo.git/objects/12/67a0fbd3ec606c20f3f1dca1f53bb9505ba9b5
|
237
238
|
- test/fixtures/dolt-test-repo.git/objects/26/4c348a80906538018616fa16fc35d04bdf38b0
|
239
|
+
- test/fixtures/dolt-test-repo.git/objects/60/eebb9021a6ce7d582c2f2d4aa5bfb3672150ae
|
238
240
|
- test/fixtures/dolt-test-repo.git/objects/85/026eda8302b98fa54cc24445a118028865a2e2
|
239
241
|
- test/fixtures/dolt-test-repo.git/objects/89/cd7e9d4564928de6b803b36c6e3d081c8d9ca1
|
240
242
|
- test/fixtures/dolt-test-repo.git/objects/b4/0c249db94476cac7fa91a9d6491c0faf21ec21
|
243
|
+
- test/fixtures/dolt-test-repo.git/objects/c0/35ba24bb3bed31589bc6736ca9b116175eb723
|
244
|
+
- test/fixtures/dolt-test-repo.git/objects/c8/cc83f1a1fc3640fce14ab73d4fa4b22b6211d8
|
245
|
+
- test/fixtures/dolt-test-repo.git/objects/de/dbf2faa4f522716ab727e4325a3d75772e137b
|
246
|
+
- test/fixtures/dolt-test-repo.git/objects/e8/d33ae69b8c4d3df1e8fad4733d69720b176849
|
247
|
+
- test/fixtures/dolt-test-repo.git/objects/e9/0021f89616ddf86855d05337c188408d3b417e
|
241
248
|
- test/fixtures/dolt-test-repo.git/objects/fc/5f5fb50b435e183925b341909610aace90a413
|
242
249
|
- test/fixtures/dolt-test-repo.git/refs/heads/master
|
243
250
|
- test/fixtures/dolt-test-repo.git/refs/tags/testable-tag
|