Re: [PATCH 10/83] builtin/apply: move 'check_index' global into 'struct apply_state'
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 26, 2016, 20:25 UTC
- Message-ID
- <xmqq7ffkf78f.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <1461504863-15946-11-git-send-email-chriscool@tuxfamily.org>
Christian Couder <christian.couder@gmail.com> writes:
Show 34 quoted lines
> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
> ---
> 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.