Subject: Re: [PATCH] builtin/remote.c: show progress when renaming remote references

From: Junio C Hamano <[email-masked]>
Date: Wed, 02 Mar 2022 11:03:42 -0800

Taylor Blau <[email-masked]> writes:

> On Wed, Mar 02, 2022 at 09:32:48AM -0500, Derrick Stolee wrote:
>> > Instead of a more complex modification to the ref transaction code,
>> > display a progress meter when running verbosely in order to convince the
>> > user that Git is doing work while renaming a remote.
>>
>> Thanks for this patch. It improves the user experience through
>> useful feedback.
>
> Admittedly, it feels like a little bit of a shortcut to avoid modifying
> the ref transaction code, but I think it's an OK short-term solution.
> Thanks for reviewing.
>
>> > @@ -682,7 +686,8 @@ static int mv(int argc, const char **argv)
>> >  		old_remote_context = STRBUF_INIT;
>> >  	struct string_list remote_branches = STRING_LIST_INIT_DUP;
>> >  	struct rename_info rename;
>> > -	int i, refspec_updated = 0;
>> > +	int i, j = 0, refspec_updated = 0;
>>
>> My only complaint is that 'j' is not informative enough here.
>>
>> 'j' as a loop iterator is good, but we aren't looping "on" j,
>> but instead tracking a progress_count across multiple loops.
>
> How about s/j/refs_renamed_nr ?

Meaning "number of renamed refs"?  start_progress() got the number
of remote branches to be renamed (i.e. rename.remote_branches->nr,
with symref adjustments), and approaching that ceiling from 0 by
counting the renamed ones so far makes sense.