forked from ruby-git/ruby-git
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added patch from eric goodwin for stashes and unit tests for stashes
- Loading branch information
Showing
3 changed files
with
85 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require File.dirname(__FILE__) + '/../test_helper' | ||
|
||
class TestEachConflict < Test::Unit::TestCase | ||
|
||
def setup | ||
set_file_paths | ||
#@git = Git.open(@wdir, :log => Logger.new(STDOUT)) | ||
@git = Git.open(@wdir) | ||
end | ||
|
||
def test_conflicts | ||
in_temp_dir do |path| | ||
g = Git.clone(@wbare, 'branch_merge_test') | ||
Dir.chdir('branch_merge_test') do | ||
|
||
g.branch('new_branch').in_branch('test') do | ||
new_file('example.txt', "1\n2\n3") | ||
g.add | ||
true | ||
end | ||
|
||
g.branch('new_branch2').in_branch('test') do | ||
new_file('example.txt', "1\n4\n3") | ||
g.add | ||
true | ||
end | ||
|
||
|
||
g.merge('new_branch') | ||
begin | ||
g.merge('new_branch2') | ||
rescue | ||
end | ||
|
||
g.each_conflict do |file, your, their| | ||
assert_equal('example.txt', file) | ||
assert_equal("1\n2\n3\n", File.read(your)) | ||
assert_equal("1\n4\n3\n", File.read(their)) | ||
end | ||
|
||
end | ||
end | ||
end | ||
|
||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require File.dirname(__FILE__) + '/../test_helper' | ||
|
||
class TestStashes < Test::Unit::TestCase | ||
def setup | ||
set_file_paths | ||
end | ||
|
||
def test_stash_unstash | ||
in_temp_dir do |path| | ||
g = Git.clone(@wbare, 'stash_test') | ||
Dir.chdir('stash_test') do | ||
assert_equal(0, g.branch.stashes.size) | ||
new_file('test-file1', 'blahblahblah1') | ||
new_file('test-file2', 'blahblahblah2') | ||
assert(g.status.untracked.assoc('test-file1')) | ||
|
||
g.add | ||
|
||
assert(g.status.added.assoc('test-file1')) | ||
|
||
g.branch.stashes.save('testing') | ||
|
||
g.reset | ||
assert_nil(g.status.untracked.assoc('test-file1')) | ||
assert_nil(g.status.added.assoc('test-file1')) | ||
|
||
g.branch.stashes.apply | ||
|
||
assert(g.status.added.assoc('test-file1')) | ||
end | ||
end | ||
end | ||
|
||
end |