gitrb 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/gitrb.gemspec +1 -1
- data/lib/gitrb/tree.rb +1 -1
- data/test/tree_test.rb +14 -0
- metadata +2 -2
data/gitrb.gemspec
CHANGED
data/lib/gitrb/tree.rb
CHANGED
@@ -73,7 +73,7 @@ module Gitrb
|
|
73
73
|
|
74
74
|
# Write an entry on specified path.
|
75
75
|
def []=(path, entry)
|
76
|
-
raise ArgumentError unless entry && GitObject === entry
|
76
|
+
raise ArgumentError unless entry && (Reference === entry || GitObject === entry)
|
77
77
|
path = normalize_path(path)
|
78
78
|
if path.empty?
|
79
79
|
raise 'Empty path'
|
data/test/tree_test.rb
CHANGED
@@ -47,6 +47,20 @@ describe Gitrb::Tree do
|
|
47
47
|
["100644", "blob", "3410062ba67c5ed59b854387a8bc0ec012479368", "c"]]
|
48
48
|
end
|
49
49
|
|
50
|
+
it "should have move" do
|
51
|
+
tree = Gitrb::Tree.new(:repository => repo)
|
52
|
+
tree['x/y'] = Gitrb::Blob.new(:data => 'a')
|
53
|
+
tree['x/y'].data.should.equal 'a'
|
54
|
+
tree.save
|
55
|
+
|
56
|
+
repo.clear
|
57
|
+
tree = repo.get(tree.id)
|
58
|
+
|
59
|
+
tree.move('x/y', 'z')
|
60
|
+
tree['x/y'].should.equal nil
|
61
|
+
tree['z'].data.should.equal 'a'
|
62
|
+
end
|
63
|
+
|
50
64
|
it "should save nested trees" do
|
51
65
|
tree = Gitrb::Tree.new(:repository => repo)
|
52
66
|
|