Subject: Re: [PATCH v7 03/12] update-index: add a new --force-write-index option

From: Junio C Hamano <[email-masked]>
Date: Wed, 20 Sep 2017 14:47:25 +0900

Ben Peart <[email-masked]> writes:

> +		OPT_SET_INT(0, "force-write-index", &force_write,
> +			N_("write out the index even if is not flagged as changed"), 1),

Hmph.  The only time this makes difference is when the code forgets
to mark active_cache_changed even when it actually made a change to
the index, no?  I do understand the wish to be able to observe what
_would_ be written if such a bug did not exist in order to debug the
other aspects of the change in this series, but at the same time I
fear that we may end up sweeping the problem under the rug by
running the tests with this option.

>  		OPT_END()
>  	};
>  
> @@ -1147,7 +1150,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
>  		die("BUG: bad untracked_cache value: %d", untracked_cache);
>  	}
>  
> -	if (active_cache_changed) {
> +	if (active_cache_changed || force_write) {
>  		if (newfd < 0) {
>  			if (refresh_args.flags & REFRESH_QUIET)
>  				exit(128);