Skip to content

Commit c8f718d

Browse files
author
Vicent Martí
committed
Merge pull request #611 from ethomson/update_libgit2
Update libgit2 to 46082c3
2 parents 5af96de + f0ec4e1 commit c8f718d

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

test/rebase_test.rb

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,54 @@ def test_inmemory_already_applied_patch
152152
assert_equal :pick, op[:type]
153153
assert_equal "0f5f6d3353be1a9966fa5767b7d604b051798224", op[:id]
154154
end
155+
156+
def test_rebase_does_not_lose_files
157+
Rugged::Commit.create(@repo, {
158+
:author => { :email => "[email protected]", :time => Time.now, :name => "Rebaser" },
159+
:committer => { :email => "[email protected]", :time => Time.now, :name => "Rebaser" },
160+
:message => "Add some files",
161+
:parents => [ @repo.branches["gravy"].target_id ],
162+
:update_ref => "refs/heads/gravy",
163+
:tree => @repo.branches["gravy"].target.tree.update([
164+
{ :action => :upsert,
165+
:path => "some/nested/file",
166+
:oid => Rugged::Blob.from_buffer(@repo, "a new blob content"),
167+
:filemode => 0100644
168+
}
169+
])
170+
})
171+
172+
rebase = Rugged::Rebase.new(@repo, "refs/heads/gravy", "refs/heads/veal")
173+
174+
assert rebase.next
175+
assert rebase.commit({ committer: { :email => "[email protected]", :name => "Rebaser" } })
176+
177+
assert rebase.next
178+
assert rebase.commit({ committer: { :email => "[email protected]", :name => "Rebaser" } })
179+
end
180+
181+
def test_inmemory_rebase_does_not_lose_files
182+
Rugged::Commit.create(@repo, {
183+
:author => { :email => "[email protected]", :time => Time.now, :name => "Rebaser" },
184+
:committer => { :email => "[email protected]", :time => Time.now, :name => "Rebaser" },
185+
:message => "Add some files",
186+
:parents => [ @repo.branches["gravy"].target_id ],
187+
:update_ref => "refs/heads/gravy",
188+
:tree => @repo.branches["gravy"].target.tree.update([
189+
{ :action => :upsert,
190+
:path => "some/nested/file",
191+
:oid => Rugged::Blob.from_buffer(@repo, "a new blob content"),
192+
:filemode => 0100644
193+
}
194+
])
195+
})
196+
197+
rebase = Rugged::Rebase.new(@repo, "refs/heads/gravy", "refs/heads/veal", inmemory: true)
198+
199+
assert rebase.next
200+
assert rebase.commit({ committer: { :email => "[email protected]", :name => "Rebaser" } })
201+
202+
assert rebase.next
203+
assert rebase.commit({ committer: { :email => "[email protected]", :name => "Rebaser" } })
204+
end
155205
end

0 commit comments

Comments
 (0)