@@ -434,7 +434,7 @@ static inline int prune_traversal(struct index_state *istate,
434
434
if (still_interesting < 0 )
435
435
return still_interesting ;
436
436
return tree_entry_interesting (istate , e , base ,
437
- 0 , info -> pathspec );
437
+ info -> pathspec );
438
438
}
439
439
440
440
int traverse_trees (struct index_state * istate ,
@@ -1015,17 +1015,17 @@ static int match_wildcard_base(const struct pathspec_item *item,
1015
1015
/*
1016
1016
* Is a tree entry interesting given the pathspec we have?
1017
1017
*
1018
- * Pre-condition: either baselen == base_offset (i.e. empty path)
1018
+ * Pre-condition: either baselen == 0 (i.e. empty path)
1019
1019
* or base[baselen-1] == '/' (i.e. with trailing slash).
1020
1020
*/
1021
1021
static enum interesting do_match (struct index_state * istate ,
1022
1022
const struct name_entry * entry ,
1023
- struct strbuf * base , int base_offset ,
1023
+ struct strbuf * base ,
1024
1024
const struct pathspec * ps ,
1025
1025
int exclude )
1026
1026
{
1027
1027
int i ;
1028
- int pathlen , baselen = base -> len - base_offset ;
1028
+ int pathlen , baselen = base -> len ;
1029
1029
enum interesting never_interesting = ps -> has_wildcard ?
1030
1030
entry_not_interesting : all_entries_not_interesting ;
1031
1031
@@ -1043,7 +1043,7 @@ static enum interesting do_match(struct index_state *istate,
1043
1043
!(ps -> magic & PATHSPEC_MAXDEPTH ) ||
1044
1044
ps -> max_depth == -1 )
1045
1045
return all_entries_interesting ;
1046
- return within_depth (base -> buf + base_offset , baselen ,
1046
+ return within_depth (base -> buf , baselen ,
1047
1047
!!S_ISDIR (entry -> mode ),
1048
1048
ps -> max_depth ) ?
1049
1049
entry_interesting : entry_not_interesting ;
@@ -1054,7 +1054,7 @@ static enum interesting do_match(struct index_state *istate,
1054
1054
for (i = ps -> nr - 1 ; i >= 0 ; i -- ) {
1055
1055
const struct pathspec_item * item = ps -> items + i ;
1056
1056
const char * match = item -> match ;
1057
- const char * base_str = base -> buf + base_offset ;
1057
+ const char * base_str = base -> buf ;
1058
1058
int matchlen = item -> len , matched = 0 ;
1059
1059
1060
1060
if ((!exclude && item -> magic & PATHSPEC_EXCLUDE ) ||
@@ -1147,9 +1147,9 @@ static enum interesting do_match(struct index_state *istate,
1147
1147
1148
1148
strbuf_add (base , entry -> path , pathlen );
1149
1149
1150
- if (!git_fnmatch (item , match , base -> buf + base_offset ,
1150
+ if (!git_fnmatch (item , match , base -> buf ,
1151
1151
item -> nowildcard_len )) {
1152
- strbuf_setlen (base , base_offset + baselen );
1152
+ strbuf_setlen (base , baselen );
1153
1153
goto interesting ;
1154
1154
}
1155
1155
@@ -1161,13 +1161,13 @@ static enum interesting do_match(struct index_state *istate,
1161
1161
* be performed in the submodule itself.
1162
1162
*/
1163
1163
if (ps -> recurse_submodules && S_ISGITLINK (entry -> mode ) &&
1164
- !ps_strncmp (item , match , base -> buf + base_offset ,
1164
+ !ps_strncmp (item , match , base -> buf ,
1165
1165
item -> nowildcard_len )) {
1166
- strbuf_setlen (base , base_offset + baselen );
1166
+ strbuf_setlen (base , baselen );
1167
1167
goto interesting ;
1168
1168
}
1169
1169
1170
- strbuf_setlen (base , base_offset + baselen );
1170
+ strbuf_setlen (base , baselen );
1171
1171
1172
1172
/*
1173
1173
* Match all directories. We'll try to match files
@@ -1203,9 +1203,9 @@ static enum interesting do_match(struct index_state *istate,
1203
1203
return entry_interesting ;
1204
1204
1205
1205
strbuf_add (base , entry -> path , pathlen );
1206
- ret = match_pathspec_attrs (istate , base -> buf + base_offset ,
1207
- base -> len - base_offset , item );
1208
- strbuf_setlen (base , base_offset + baselen );
1206
+ ret = match_pathspec_attrs (istate , base -> buf ,
1207
+ base -> len , item );
1208
+ strbuf_setlen (base , baselen );
1209
1209
if (!ret )
1210
1210
continue ;
1211
1211
}
@@ -1217,16 +1217,16 @@ static enum interesting do_match(struct index_state *istate,
1217
1217
/*
1218
1218
* Is a tree entry interesting given the pathspec we have?
1219
1219
*
1220
- * Pre-condition: either baselen == base_offset (i.e. empty path)
1220
+ * Pre-condition: either baselen == 0 (i.e. empty path)
1221
1221
* or base[baselen-1] == '/' (i.e. with trailing slash).
1222
1222
*/
1223
1223
enum interesting tree_entry_interesting (struct index_state * istate ,
1224
1224
const struct name_entry * entry ,
1225
- struct strbuf * base , int base_offset ,
1225
+ struct strbuf * base ,
1226
1226
const struct pathspec * ps )
1227
1227
{
1228
1228
enum interesting positive , negative ;
1229
- positive = do_match (istate , entry , base , base_offset , ps , 0 );
1229
+ positive = do_match (istate , entry , base , ps , 0 );
1230
1230
1231
1231
/*
1232
1232
* case | entry | positive | negative | result
@@ -1263,7 +1263,7 @@ enum interesting tree_entry_interesting(struct index_state *istate,
1263
1263
positive <= entry_not_interesting ) /* #1, #2, #11, #12 */
1264
1264
return positive ;
1265
1265
1266
- negative = do_match (istate , entry , base , base_offset , ps , 1 );
1266
+ negative = do_match (istate , entry , base , ps , 1 );
1267
1267
1268
1268
/* #8, #18 */
1269
1269
if (positive == all_entries_interesting &&
0 commit comments