Subject: Re: [PATCH 10/83] builtin/apply: move 'check_index' global into 'struct apply_state'

From: Junio C Hamano <[email-masked]>
Date: Tue, 26 Apr 2016 13:25:04 -0700

Christian Couder <[email-masked]> writes:

> Signed-off-by: Christian Couder <[email-masked]>
> ---
>  builtin/apply.c | 69 +++++++++++++++++++++++++++++++++------------------------
>  1 file changed, 40 insertions(+), 29 deletions(-)
>
> diff --git a/builtin/apply.c b/builtin/apply.c
> index 6c628f6..3f8671c 100644
> --- a/builtin/apply.c
> +++ b/builtin/apply.c
> @@ -30,6 +30,10 @@ struct apply_state {
>  	 *    files that are being modified, but doesn't apply the patch
>  	 */
>  	int check;
> +
> +	/* --index updates the cache as well. */
> +	int check_index;
> +
>  	int unidiff_zero;
>  };
>  
> @@ -37,14 +41,12 @@ struct apply_state {
>   *  --stat does just a diffstat, and doesn't actually apply
>   *  --numstat does numeric diffstat, and doesn't actually apply
>   *  --index-info shows the old and new index info for paths if available.
> - *  --index updates the cache as well.
>   *  --cached updates only the cache without ever touching the working tree.
>   */
>  static int newfd = -1;
>  
>  static int state_p_value = 1;
>  static int p_value_known;
> -static int check_index;
>  static int update_index;
>  static int cached;

I like the way this series moves only a few variables at a time to
limit the scope of each step.  I would have expected check-index and
cached to touch pretty much the same codepaths (the latter would
involve a subset of the codepaths involved for the former), but
doing them separately is fine.