File tree 3 files changed +85
-2
lines changed
3 files changed +85
-2
lines changed Original file line number Diff line number Diff line change @@ -12,8 +12,6 @@ def initialize(base, name)
12
12
@full = name
13
13
@base = base
14
14
15
- @stashes = Git ::Stashes . new ( @base )
16
-
17
15
parts = name . split ( '/' )
18
16
if parts [ 1 ]
19
17
@remote = Git ::Remote . new ( @base , parts [ 0 ] )
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env ruby
2
+
3
+ require File . dirname ( __FILE__ ) + '/../test_helper'
4
+
5
+ class TestEachConflict < Test ::Unit ::TestCase
6
+
7
+ def setup
8
+ set_file_paths
9
+ #@git = Git.open(@wdir, :log => Logger.new(STDOUT))
10
+ @git = Git . open ( @wdir )
11
+ end
12
+
13
+ def test_conflicts
14
+ in_temp_dir do |path |
15
+ g = Git . clone ( @wbare , 'branch_merge_test' )
16
+ Dir . chdir ( 'branch_merge_test' ) do
17
+
18
+ g . branch ( 'new_branch' ) . in_branch ( 'test' ) do
19
+ new_file ( 'example.txt' , "1\n 2\n 3" )
20
+ g . add
21
+ true
22
+ end
23
+
24
+ g . branch ( 'new_branch2' ) . in_branch ( 'test' ) do
25
+ new_file ( 'example.txt' , "1\n 4\n 3" )
26
+ g . add
27
+ true
28
+ end
29
+
30
+
31
+ g . merge ( 'new_branch' )
32
+ begin
33
+ g . merge ( 'new_branch2' )
34
+ rescue
35
+ end
36
+
37
+ g . each_conflict do |file , your , their |
38
+ assert_equal ( 'example.txt' , file )
39
+ assert_equal ( "1\n 2\n 3\n " , File . read ( your ) )
40
+ assert_equal ( "1\n 4\n 3\n " , File . read ( their ) )
41
+ end
42
+
43
+ end
44
+ end
45
+ end
46
+
47
+
48
+
49
+ end
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env ruby
2
+
3
+ require File . dirname ( __FILE__ ) + '/../test_helper'
4
+
5
+ class TestStashes < Test ::Unit ::TestCase
6
+ def setup
7
+ set_file_paths
8
+ end
9
+
10
+ def test_stash_unstash
11
+ in_temp_dir do |path |
12
+ g = Git . clone ( @wbare , 'stash_test' )
13
+ Dir . chdir ( 'stash_test' ) do
14
+ assert_equal ( 0 , g . branch . stashes . size )
15
+ new_file ( 'test-file1' , 'blahblahblah1' )
16
+ new_file ( 'test-file2' , 'blahblahblah2' )
17
+ assert ( g . status . untracked . assoc ( 'test-file1' ) )
18
+
19
+ g . add
20
+
21
+ assert ( g . status . added . assoc ( 'test-file1' ) )
22
+
23
+ g . branch . stashes . save ( 'testing' )
24
+
25
+ g . reset
26
+ assert_nil ( g . status . untracked . assoc ( 'test-file1' ) )
27
+ assert_nil ( g . status . added . assoc ( 'test-file1' ) )
28
+
29
+ g . branch . stashes . apply
30
+
31
+ assert ( g . status . added . assoc ( 'test-file1' ) )
32
+ end
33
+ end
34
+ end
35
+
36
+ end
You can’t perform that action at this time.
0 commit comments