Re: [PATCH v7] describe: refresh the index when 'broken' flag is used
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 27, 2024, 15:47 UTC
- Message-ID
- <xmqqfrsyv155.fsf@gitster.g>
- In-Reply-To
- <03628ece-4f47-40d5-a926-acce684a21e5@gmail.com>
Abhijeet Sonar <abhijeet.nkt@gmail.com> writes:
Show 14 quoted lines
> I have a question: > > Why does --dirty code path also not call git-update-index and instead does > > setup_work_tree(); > prepare_repo_settings(the_repository); > the_repository->settings.command_requires_full_index = 0; > repo_read_index(the_repository); > refresh_index(...); > fd = repo_hold_locked_index(...); > if (0 <= fd) > repo_update_index_if_able(the_repository, &index_lock); > > I assume they are equivalent?
Now we are going back full circles ;-)?
Your earliest attempt indeed copied the above to the code paths used to handle "--broken", but then Phillip corrected the course
https://lore.kernel.org/git/054c6ac1-4714-4600-afa5-7e9b6e9b0e72@gmail.com/
to avoid triggering an in-process error and instead run an equivalent "update-index --refresh" via the run_command() interface, so that we can catch potential errors. The code in the more recent rounds of your patch uses that, no?
> The commit which introduced this -- > bb571486ae93d02746c4bcc8032bde306f6d399a (describe: Refresh the index > when run with --dirty) seems to be for the same objective as mu patch.
Yes, but the cited message above explains the reason why the two code paths in your patch use different implementations, I would think.