@@ -521,7 +521,7 @@ int traverse_trees(struct index_state *istate,
if (!entry[i].path)
continue;
mask |= 1ul << i;
- if (S_ISDIR(entry[i].mode))
+ if (entry[i].object_type == OBJ_TREE)
dirmask |= 1ul << i;
e = &entry[i];
}
@@ -892,8 +892,8 @@ static int match_entry(const struct pathspec_item *item,
* nothing else (to handle 'submod/' and 'submod'
* uniformly).
*/
- if (!S_ISDIR(entry->mode) &&
- (!S_ISGITLINK(entry->mode) || matchlen > pathlen + 1))
+ if (entry->object_type != OBJ_TREE &&
+ (entry->object_type != OBJ_COMMIT || matchlen > pathlen + 1))
return 0;
}
@@ -1038,7 +1038,7 @@ static enum interesting do_match(struct index_state *istate,
ps->max_depth == -1)
return all_entries_interesting;
return within_depth(base->buf + base_offset, baselen,
- !!S_ISDIR(entry->mode),
+ entry->object_type == OBJ_TREE,
ps->max_depth) ?
entry_interesting : entry_not_interesting;
}
@@ -1071,7 +1071,7 @@ static enum interesting do_match(struct index_state *istate,
if (within_depth(base_str + matchlen + 1,
baselen - matchlen - 1,
- !!S_ISDIR(entry->mode),
+ entry->object_type == OBJ_TREE,
ps->max_depth))
goto interesting;
else
@@ -1094,7 +1094,8 @@ static enum interesting do_match(struct index_state *istate,
* Match all directories. We'll try to
* match files later on.
*/
- if (ps->recursive && S_ISDIR(entry->mode))
+ if (ps->recursive &&
+ entry->object_type == OBJ_TREE)
return entry_interesting;
/*
@@ -1105,7 +1106,7 @@ static enum interesting do_match(struct index_state *istate,
* be performed in the submodule itself.
*/
if (ps->recurse_submodules &&
- S_ISGITLINK(entry->mode) &&
+ entry->object_type == OBJ_COMMIT &&
!ps_strncmp(item, match + baselen,
entry->path,
item->nowildcard_len - baselen))
@@ -1154,7 +1155,8 @@ static enum interesting do_match(struct index_state *istate,
* character. More accurate matching can then
* be performed in the submodule itself.
*/
- if (ps->recurse_submodules && S_ISGITLINK(entry->mode) &&
+ if (ps->recurse_submodules &&
+ entry->object_type == OBJ_COMMIT &&
!ps_strncmp(item, match, base->buf + base_offset,
item->nowildcard_len)) {
strbuf_setlen(base, base_offset + baselen);
@@ -1170,7 +1172,7 @@ static enum interesting do_match(struct index_state *istate,
* in future, see
* https://lore.kernel.org/git/7vmxo5l2g4.fsf@alter.siamese.dyndns.org/
*/
- if (ps->recursive && S_ISDIR(entry->mode))
+ if (ps->recursive && entry->object_type == OBJ_TREE)
return entry_interesting;
continue;
interesting:
@@ -1193,7 +1195,7 @@ static enum interesting do_match(struct index_state *istate,
* can probably return all_entries_interesting or
* all_entries_not_interesting here if matched.
*/
- if (S_ISDIR(entry->mode))
+ if (entry->object_type == OBJ_TREE)
return entry_interesting;
strbuf_add(base, entry->path, pathlen);
@@ -1269,7 +1271,7 @@ enum interesting tree_entry_interesting(struct index_state *istate,
return positive;
/* #15, #19 */
- if (S_ISDIR(entry->mode) &&
+ if (entry->object_type == OBJ_TREE &&
positive >= entry_interesting &&
negative == entry_interesting)
return entry_interesting;
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- tree-walk.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)