From: Elijah Newren Date: Thu, 26 Aug 2010 06:21:48 +0000 (-0600) Subject: tree_entry_interesting(): Make return value more specific X-Git-Tag: v1.7.4-rc0~171^2~1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4a5e74feb1a75a479acbc2f839e930966fdc2f2f;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/tree-diff.c b/tree-diff.c index 4d85fef5d..1b41b7f45 100644 --- a/tree-diff.c +++ b/tree-diff.c @@ -103,7 +103,7 @@ static int tree_entry_interesting(struct tree_desc *desc, const char *base, int int never_interesting = -1; if (!opt->nr_paths) - return 1; + return 2; sha1 = tree_entry_extract(desc, &path, &mode);