Skip to content

Commit 4a5e74f

Browse files
newrengitster
authored andcommitted
tree_entry_interesting(): Make return value more specific
tree_entry_interesting() can signal to its callers not only if the given entry matches one of the specified paths, but whether all remaining paths will (or will not) match. When no paths are specified, all paths are considered interesting, so intead of returning 1 (this path is interesting) return 2 (all paths are interesting). This will allow the caller to avoid calling tree_entry_interesting() again, which theoretically should speed up tree walking. I am not able to measure any actual gains in practice, but it certainly can not hurt and seems to make the code more readable to me. Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent dabb061 commit 4a5e74f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tree-diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static int tree_entry_interesting(struct tree_desc *desc, const char *base, int
103103
int never_interesting = -1;
104104

105105
if (!opt->nr_paths)
106-
return 1;
106+
return 2;
107107

108108
sha1 = tree_entry_extract(desc, &path, &mode);
109109

0 commit comments

Comments
 (0)