@@ -434,7 +434,7 @@ static inline int prune_traversal(struct index_state *istate,
434434 if (still_interesting < 0 )
435435 return still_interesting ;
436436 return tree_entry_interesting (istate , e , base ,
437- 0 , info -> pathspec );
437+ info -> pathspec );
438438}
439439
440440int traverse_trees (struct index_state * istate ,
@@ -1015,17 +1015,17 @@ static int match_wildcard_base(const struct pathspec_item *item,
10151015/*
10161016 * Is a tree entry interesting given the pathspec we have?
10171017 *
1018- * Pre-condition: either baselen == base_offset (i.e. empty path)
1018+ * Pre-condition: either baselen == 0 (i.e. empty path)
10191019 * or base[baselen-1] == '/' (i.e. with trailing slash).
10201020 */
10211021static enum interesting do_match (struct index_state * istate ,
10221022 const struct name_entry * entry ,
1023- struct strbuf * base , int base_offset ,
1023+ struct strbuf * base ,
10241024 const struct pathspec * ps ,
10251025 int exclude )
10261026{
10271027 int i ;
1028- int pathlen , baselen = base -> len - base_offset ;
1028+ int pathlen , baselen = base -> len ;
10291029 enum interesting never_interesting = ps -> has_wildcard ?
10301030 entry_not_interesting : all_entries_not_interesting ;
10311031
@@ -1043,7 +1043,7 @@ static enum interesting do_match(struct index_state *istate,
10431043 !(ps -> magic & PATHSPEC_MAXDEPTH ) ||
10441044 ps -> max_depth == -1 )
10451045 return all_entries_interesting ;
1046- return within_depth (base -> buf + base_offset , baselen ,
1046+ return within_depth (base -> buf , baselen ,
10471047 !!S_ISDIR (entry -> mode ),
10481048 ps -> max_depth ) ?
10491049 entry_interesting : entry_not_interesting ;
@@ -1054,7 +1054,7 @@ static enum interesting do_match(struct index_state *istate,
10541054 for (i = ps -> nr - 1 ; i >= 0 ; i -- ) {
10551055 const struct pathspec_item * item = ps -> items + i ;
10561056 const char * match = item -> match ;
1057- const char * base_str = base -> buf + base_offset ;
1057+ const char * base_str = base -> buf ;
10581058 int matchlen = item -> len , matched = 0 ;
10591059
10601060 if ((!exclude && item -> magic & PATHSPEC_EXCLUDE ) ||
@@ -1147,9 +1147,9 @@ static enum interesting do_match(struct index_state *istate,
11471147
11481148 strbuf_add (base , entry -> path , pathlen );
11491149
1150- if (!git_fnmatch (item , match , base -> buf + base_offset ,
1150+ if (!git_fnmatch (item , match , base -> buf ,
11511151 item -> nowildcard_len )) {
1152- strbuf_setlen (base , base_offset + baselen );
1152+ strbuf_setlen (base , baselen );
11531153 goto interesting ;
11541154 }
11551155
@@ -1161,13 +1161,13 @@ static enum interesting do_match(struct index_state *istate,
11611161 * be performed in the submodule itself.
11621162 */
11631163 if (ps -> recurse_submodules && S_ISGITLINK (entry -> mode ) &&
1164- !ps_strncmp (item , match , base -> buf + base_offset ,
1164+ !ps_strncmp (item , match , base -> buf ,
11651165 item -> nowildcard_len )) {
1166- strbuf_setlen (base , base_offset + baselen );
1166+ strbuf_setlen (base , baselen );
11671167 goto interesting ;
11681168 }
11691169
1170- strbuf_setlen (base , base_offset + baselen );
1170+ strbuf_setlen (base , baselen );
11711171
11721172 /*
11731173 * Match all directories. We'll try to match files
@@ -1203,9 +1203,9 @@ static enum interesting do_match(struct index_state *istate,
12031203 return entry_interesting ;
12041204
12051205 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 );
12091209 if (!ret )
12101210 continue ;
12111211 }
@@ -1217,16 +1217,16 @@ static enum interesting do_match(struct index_state *istate,
12171217/*
12181218 * Is a tree entry interesting given the pathspec we have?
12191219 *
1220- * Pre-condition: either baselen == base_offset (i.e. empty path)
1220+ * Pre-condition: either baselen == 0 (i.e. empty path)
12211221 * or base[baselen-1] == '/' (i.e. with trailing slash).
12221222 */
12231223enum interesting tree_entry_interesting (struct index_state * istate ,
12241224 const struct name_entry * entry ,
1225- struct strbuf * base , int base_offset ,
1225+ struct strbuf * base ,
12261226 const struct pathspec * ps )
12271227{
12281228 enum interesting positive , negative ;
1229- positive = do_match (istate , entry , base , base_offset , ps , 0 );
1229+ positive = do_match (istate , entry , base , ps , 0 );
12301230
12311231 /*
12321232 * case | entry | positive | negative | result
@@ -1263,7 +1263,7 @@ enum interesting tree_entry_interesting(struct index_state *istate,
12631263 positive <= entry_not_interesting ) /* #1, #2, #11, #12 */
12641264 return positive ;
12651265
1266- negative = do_match (istate , entry , base , base_offset , ps , 1 );
1266+ negative = do_match (istate , entry , base , ps , 1 );
12671267
12681268 /* #8, #18 */
12691269 if (positive == all_entries_interesting &&
0 commit comments