File tree 2 files changed +8
-1
lines changed
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,7 @@ def process_full_diff
133
133
current_file = Git ::EscapedPath . new ( m [ 2 ] ) . unescape
134
134
final [ current_file ] = defaults . merge ( { :patch => line , :path => current_file } )
135
135
else
136
+ next unless current_file # Protects against warnings or other garbage output preceeding the diff
136
137
if m = /^index ([0-9a-f]{4,40})\. \. ([0-9a-f]{4,40})( ......)*/ . match ( line )
137
138
final [ current_file ] [ :src ] = m [ 1 ]
138
139
final [ current_file ] [ :dst ] = m [ 2 ]
Original file line number Diff line number Diff line change @@ -120,5 +120,11 @@ def test_diff_each
120
120
assert_equal ( 160 , files [ 'scott/newfile' ] . patch . size )
121
121
end
122
122
123
-
123
+ def test_diff_process_full_with_warnings
124
+ @diff . send ( :cache_full ) # prime the cache
125
+ warning = "Warning: Permanently added the ECDSA host key for IP address '000.00.000.0' to the list of known hosts.\n "
126
+ @diff . instance_variable_set ( :@full_diff , warning + @diff . instance_variable_get ( :@full_diff ) )
127
+
128
+ assert_equal ( '5d46068' , @diff [ "scott/newfile" ] . src )
129
+ end
124
130
end
You can’t perform that action at this time.
0 commit comments