libdolt 0.33.7 → 0.33.8
Sign up to get free protection for your applications and to get access to all the features.
@@ -29,8 +29,14 @@ module Dolt
|
|
29
29
|
|
30
30
|
def blob(repo, ref, path)
|
31
31
|
repository = resolve_repository(repo)
|
32
|
+
blob = repository.rev_parse(ref)
|
33
|
+
|
34
|
+
if !blob.is_a?(Rugged::Blob)
|
35
|
+
blob = repository.rev_parse("#{ref}:#{path}")
|
36
|
+
end
|
37
|
+
|
32
38
|
tpl_data(repository, ref, path, {
|
33
|
-
:blob =>
|
39
|
+
:blob => blob,
|
34
40
|
:filemode => filemode(repository, ref, path)
|
35
41
|
})
|
36
42
|
end
|
@@ -131,6 +137,8 @@ module Dolt
|
|
131
137
|
refspec = "#{ref}:#{File.dirname(path).sub(/^\.$/, '')}"
|
132
138
|
entry = repo.rev_parse(refspec).find { |e| e[:name] == file }
|
133
139
|
entry.nil? ? nil : entry[:filemode].to_s(8)
|
140
|
+
rescue Rugged::InvalidError
|
141
|
+
"100644" # Pretty much a guess :/
|
134
142
|
end
|
135
143
|
end
|
136
144
|
|
data/lib/libdolt/version.rb
CHANGED
@@ -55,6 +55,14 @@ describe Dolt::RepositoryLookup do
|
|
55
55
|
assert Rugged::Blob === data[:blob]
|
56
56
|
assert_equal "100644", data[:filemode]
|
57
57
|
end
|
58
|
+
|
59
|
+
it "looks up blob by sha1" do
|
60
|
+
data = @lookup.blob("gitorious", "c035ba24bb3bed31589bc6736ca9b116175eb723", "README.org")
|
61
|
+
assert_equal "gitorious", data[:repository_slug]
|
62
|
+
assert_equal "c035ba24bb3bed31589bc6736ca9b116175eb723", data[:ref]
|
63
|
+
assert Rugged::Blob === data[:blob]
|
64
|
+
assert_equal "100644", data[:filemode]
|
65
|
+
end
|
58
66
|
end
|
59
67
|
|
60
68
|
describe "#tree" do
|
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.33.
|
4
|
+
version: 0.33.8
|
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-11-
|
12
|
+
date: 2013-11-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rugged
|
@@ -357,7 +357,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
357
357
|
version: '0'
|
358
358
|
requirements: []
|
359
359
|
rubyforge_project: libdolt
|
360
|
-
rubygems_version: 1.8.
|
360
|
+
rubygems_version: 1.8.24
|
361
361
|
signing_key:
|
362
362
|
specification_version: 3
|
363
363
|
summary: Dolt API for serving git trees and syntax highlighted blobs
|