Re: [PATCH v7 03/12] update-index: add a new --force-write-index option
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 20, 2017, 05:47 UTC
- Message-ID
- <xmqq7ewtor9u.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20170919192744.19224-4-benpeart@microsoft.com>
Ben Peart <benpeart@microsoft.com> 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.
Show 12 quoted lines
> 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);