gitrb 0.0.9 → 0.1.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/gitrb.gemspec +1 -1
- data/lib/gitrb/blob.rb +1 -1
- data/lib/gitrb/reference.rb +3 -4
- data/lib/gitrb/tree.rb +4 -4
- metadata +2 -2
data/gitrb.gemspec
CHANGED
data/lib/gitrb/blob.rb
CHANGED
data/lib/gitrb/reference.rb
CHANGED
@@ -12,12 +12,11 @@ module Gitrb
|
|
12
12
|
instance_eval %{def self.#{name}(*args, &block); @object.send("#{name}", *args, &block); end}
|
13
13
|
@object.send(name, *args, &block)
|
14
14
|
elsif name == :type && (mode = @properties['mode'] || @properties[:mode])
|
15
|
-
mode
|
16
|
-
return (mode & 0x4000 == 0x4000) ? :tree : :blob
|
15
|
+
(mode & 040000 == 040000) ? :tree : :blob
|
17
16
|
elsif @properties.include?(name)
|
18
|
-
|
17
|
+
@properties[name]
|
19
18
|
elsif @properties.include?(name.to_s)
|
20
|
-
|
19
|
+
@properties[name.to_s]
|
21
20
|
elsif object
|
22
21
|
method_missing(name, *args, &block)
|
23
22
|
else
|
data/lib/gitrb/tree.rb
CHANGED
@@ -9,7 +9,7 @@ module Gitrb
|
|
9
9
|
def initialize(options = {})
|
10
10
|
super(options)
|
11
11
|
@children = {}
|
12
|
-
@mode = options[:mode] ||
|
12
|
+
@mode = options[:mode] || 040000
|
13
13
|
parse(options[:data]) if options[:data]
|
14
14
|
@modified = true if !id
|
15
15
|
end
|
@@ -36,11 +36,11 @@ module Gitrb
|
|
36
36
|
def dump
|
37
37
|
@children.to_a.sort {|a,b| a.first <=> b.first }.map do |name, child|
|
38
38
|
child.save if !(Reference === child) || child.resolved?
|
39
|
-
"#{child.mode} #{name}\0#{repository.set_encoding [child.id].pack("H*")}"
|
39
|
+
"#{child.mode.to_s(8)} #{name}\0#{repository.set_encoding [child.id].pack("H*")}"
|
40
40
|
end.join
|
41
41
|
end
|
42
42
|
|
43
|
-
# Save this
|
43
|
+
# Save this tree back to the git repository.
|
44
44
|
#
|
45
45
|
# Returns the object id of the tree.
|
46
46
|
def save
|
@@ -137,7 +137,7 @@ module Gitrb
|
|
137
137
|
@children.clear
|
138
138
|
data = StringIO.new(data)
|
139
139
|
while !data.eof?
|
140
|
-
mode =
|
140
|
+
mode = Util.read_bytes_until(data, ' ').to_i(8)
|
141
141
|
name = repository.set_encoding Util.read_bytes_until(data, "\0")
|
142
142
|
id = repository.set_encoding data.read(20).unpack("H*").first
|
143
143
|
@children[name] = Reference.new(:repository => repository, :id => id, :mode => mode)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Mendler
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-05-
|
12
|
+
date: 2010-05-26 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|