File tree 1 file changed +10
-5
lines changed 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -116,20 +116,25 @@ def cache_stats
116
116
117
117
# break up @diff_full
118
118
def process_full_diff
119
+ defaults = {
120
+ :mode => '' ,
121
+ :src => '' ,
122
+ :dst => '' ,
123
+ :type => 'modified'
124
+ }
119
125
final = { }
120
126
current_file = nil
121
127
@full_diff . split ( "\n " ) . each do |line |
122
- if m = /diff --git a\/ (.*?) b\/ (.*?)/ . match ( line )
128
+ if m = /^ diff --git a\/ (.*?) b\/ (.*?)/ . match ( line )
123
129
current_file = m [ 1 ]
124
- final [ current_file ] = { :patch => line , :path => current_file ,
125
- :mode => '' , :src => '' , :dst => '' , :type => 'modified' }
130
+ final [ current_file ] = defaults . merge ( { :patch => line , :path => current_file } )
126
131
else
127
- if m = /index (.......)\. \. (.......)( ......)*/ . match ( line )
132
+ if m = /^ index (.......)\. \. (.......)( ......)*/ . match ( line )
128
133
final [ current_file ] [ :src ] = m [ 1 ]
129
134
final [ current_file ] [ :dst ] = m [ 2 ]
130
135
final [ current_file ] [ :mode ] = m [ 3 ] . strip if m [ 3 ]
131
136
end
132
- if m = /(. *?) file mode (......)/ . match ( line )
137
+ if m = /^([[:alpha:]] *?) file mode (......)/ . match ( line )
133
138
final [ current_file ] [ :type ] = m [ 1 ]
134
139
final [ current_file ] [ :mode ] = m [ 2 ]
135
140
end
You can’t perform that action at this time.
0 commit comments