@@ -118,18 +118,25 @@ var highlightDiff = function(diff, element, callbacks) {
118
118
119
119
var firstChar = l . charAt ( 0 ) ;
120
120
121
- if ( firstChar == "d" && l . charAt ( 1 ) == "i" ) { // "diff", i.e. new file, we have to reset everything
122
- header = true ; // diff always starts with a header
121
+ if ( firstChar == "d" && l . charAt ( 1 ) == "i" ) {
122
+ // " diff", i.e. new file, we have to reset everything
123
123
124
- finishContent ( ) ; // Finish last file
124
+ // diff always starts with a header
125
+ header = true ;
126
+
127
+ // Finish last file
128
+ finishContent ( ) ;
125
129
126
130
binary = false ;
127
131
mode_change = false ;
128
132
129
- if ( match = l . match ( / ^ d i f f - - g i t ( a \/ ) + ( .* ) ( b \/ ) + ( .* ) $ / ) ) { // there are cases when we need to capture filenames from
130
- startname = match [ 2 ] ; // the diff line, like with mode-changes.
131
- endname = match [ 4 ] ; // this can get overwritten later if there is a diff or if
132
- } // the file is binary
133
+ // there are cases when we need to capture filenames from the diff
134
+ // line, like with mode-changes. this can get overridden later if
135
+ // there is a diff or if the file is binary
136
+ if ( match = l . match ( / ^ d i f f - - g i t ( [ a - z ] \/ ) + ( .* ) ( [ a - z ] \/ ) + ( .* ) $ / ) ) {
137
+ startname = match [ 2 ] ;
138
+ endname = match [ 4 ] ;
139
+ }
133
140
134
141
continue ;
135
142
}
@@ -159,12 +166,12 @@ var highlightDiff = function(diff, element, callbacks) {
159
166
continue ;
160
167
}
161
168
if ( firstChar == "-" ) {
162
- if ( match = l . match ( / ^ - - - ( a \/ ) ? ( .* ) $ / ) )
169
+ if ( match = l . match ( / ^ - - - ( [ a - z ] \/ ) ? ( .* ) $ / ) )
163
170
startname = match [ 2 ] ;
164
171
continue ;
165
172
}
166
173
if ( firstChar == "+" ) {
167
- if ( match = l . match ( / ^ \+ \+ \+ ( b \/ ) ? ( .* ) $ / ) )
174
+ if ( match = l . match ( / ^ \+ \+ \+ ( [ a - z ] \/ ) ? ( .* ) $ / ) )
168
175
endname = match [ 2 ] ;
169
176
continue ;
170
177
}
@@ -187,7 +194,7 @@ var highlightDiff = function(diff, element, callbacks) {
187
194
// We might not have a diff from the binary file if it's new.
188
195
// So, we use a regex to figure that out
189
196
190
- if ( match = l . match ( / ^ B i n a r y f i l e s ( a \/ ) ? ( .* ) a n d ( b \/ ) ? ( .* ) d i f f e r $ / ) )
197
+ if ( match = l . match ( / ^ B i n a r y f i l e s ( [ a - z ] \/ ) ? ( .* ) a n d ( [ a - z ] \/ ) ? ( .* ) d i f f e r $ / ) )
191
198
{
192
199
startname = match [ 2 ] ;
193
200
endname = match [ 4 ] ;
0 commit comments