File tree Expand file tree Collapse file tree 3 files changed +10
-16
lines changed Expand file tree Collapse file tree 3 files changed +10
-16
lines changed Original file line number Diff line number Diff line change 6
6
# Note that changes in the inspected code, or installation of new
7
7
# versions of RuboCop, may require this file to be generated again.
8
8
9
-
10
- # Offense count: 2
11
- # Configuration parameters: AllowComments, AllowNil.
12
- Lint/SuppressedException :
13
- Exclude :
14
- - ' lib/git/lib.rb'
15
- - ' tests/units/test_each_conflict.rb'
16
-
17
9
# Offense count: 1
18
10
Lint/UselessConstantScoping :
19
11
Exclude :
Original file line number Diff line number Diff line change @@ -707,12 +707,7 @@ def worktree_prune
707
707
708
708
def list_files ( ref_dir )
709
709
dir = File . join ( @git_dir , 'refs' , ref_dir )
710
- files = [ ]
711
- begin
712
- files = Dir . glob ( '**/*' , base : dir ) . select { |f | File . file? ( File . join ( dir , f ) ) }
713
- rescue StandardError
714
- end
715
- files
710
+ Dir . glob ( '**/*' , base : dir ) . select { |f | File . file? ( File . join ( dir , f ) ) }
716
711
end
717
712
718
713
# The state and name of branch pointed to by `HEAD`
Original file line number Diff line number Diff line change 5
5
class TestEachConflict < Test ::Unit ::TestCase
6
6
def test_conflicts
7
7
in_temp_repo ( 'working' ) do
8
+ # Setup a repository with a conflict
8
9
g = Git . open ( '.' )
9
10
10
- g . branch ( 'new_branch' ) . in_branch ( 'test ' ) do
11
+ g . branch ( 'new_branch' ) . in_branch ( 'commit message ' ) do
11
12
new_file ( 'example.txt' , "1\n 2\n 3" )
12
13
g . add
13
14
true
@@ -20,11 +21,17 @@ def test_conflicts
20
21
end
21
22
22
23
g . merge ( 'new_branch' )
24
+
23
25
begin
24
26
g . merge ( 'new_branch2' )
25
- rescue StandardError
27
+ rescue Git ::FailedError => e
28
+ assert_equal ( 1 , e . result . status . exitstatus )
29
+ assert_match ( /CONFLICT/ , e . result . stdout )
26
30
end
27
31
32
+ assert_equal ( 1 , g . lib . unmerged . size )
33
+
34
+ # Check the conflict
28
35
g . each_conflict do |file , your , their |
29
36
assert_equal ( 'example.txt' , file )
30
37
assert_equal ( "1\n 2\n 3\n " , File . read ( your ) )
You can’t perform that action at this time.
0 commit comments