Subject: Re: [PATCH 5/5] grep: enable recurse-submodules to work on <tree> objects

From: Brandon Williams <[email-masked]>
Date: Fri, 28 Oct 2016 12:35:34 -0700

On 10/27, Brandon Williams wrote:
> diff --git a/tree-walk.c b/tree-walk.c
> index 828f4356b..b3f996174 100644
> --- a/tree-walk.c
> +++ b/tree-walk.c
> @@ -999,10 +999,11 @@ static enum interesting do_match(const struct name_entry *entry,
>  					return entry_interesting;
>  
>  				/*
> -				 * Match all directories. We'll try to
> -				 * match files later on.
> +				 * Match all directories and gitlinks. We'll
> +				 * try to match files later on.
>  				 */
> -				if (ps->recursive && S_ISDIR(entry->mode))
> +				if (ps->recursive && (S_ISDIR(entry->mode) ||
> +						      S_ISGITLINK(entry->mode)))
>  					return entry_interesting;
>  			}
>  
> @@ -1043,13 +1044,13 @@ static enum interesting do_match(const struct name_entry *entry,
>  		strbuf_setlen(base, base_offset + baselen);
>  
>  		/*
> -		 * Match all directories. We'll try to match files
> -		 * later on.
> -		 * max_depth is ignored but we may consider support it
> -		 * in future, see
> +		 * Match all directories and gitlinks. We'll try to match files
> +		 * later on.  max_depth is ignored but we may consider support
> +		 * it in future, see
>  		 * http://thread.gmane.org/gmane.comp.version-control.git/163757/focus=163840
>  		 */
> -		if (ps->recursive && S_ISDIR(entry->mode))
> +		if (ps->recursive && (S_ISDIR(entry->mode) ||
> +				      S_ISGITLINK(entry->mode)))
>  			return entry_interesting;
>  	}
>  	return never_interesting; /* No matches */

Looks like this change actually breaks a test in t4010-diff-pathspec.sh.
I think I'll have to add a flag to optionally let through submodules as
apposed to just treating them like directories.

-- 
Brandon Williams