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 66# Note that changes in the inspected code, or installation of new
77# versions of RuboCop, may require this file to be generated again.
88
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-
179# Offense count: 1
1810Lint/UselessConstantScoping :
1911 Exclude :
Original file line number Diff line number Diff line change @@ -707,12 +707,7 @@ def worktree_prune
707707
708708 def list_files ( ref_dir )
709709 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 ) ) }
716711 end
717712
718713 # The state and name of branch pointed to by `HEAD`
Original file line number Diff line number Diff line change 55class TestEachConflict < Test ::Unit ::TestCase
66 def test_conflicts
77 in_temp_repo ( 'working' ) do
8+ # Setup a repository with a conflict
89 g = Git . open ( '.' )
910
10- g . branch ( 'new_branch' ) . in_branch ( 'test ' ) do
11+ g . branch ( 'new_branch' ) . in_branch ( 'commit message ' ) do
1112 new_file ( 'example.txt' , "1\n 2\n 3" )
1213 g . add
1314 true
@@ -20,11 +21,17 @@ def test_conflicts
2021 end
2122
2223 g . merge ( 'new_branch' )
24+
2325 begin
2426 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 )
2630 end
2731
32+ assert_equal ( 1 , g . lib . unmerged . size )
33+
34+ # Check the conflict
2835 g . each_conflict do |file , your , their |
2936 assert_equal ( 'example.txt' , file )
3037 assert_equal ( "1\n 2\n 3\n " , File . read ( your ) )
You can’t perform that action at this time.
0 commit comments