Re: [PATCH v2] fetch: no FETCH_HEAD display if --no-write-fetch-head

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonathan Nieder <jrnieder@xxxxxxxxx> writes:

>>  builtin/fetch.c          |  8 +++++++-
>>  t/t0410-partial-clone.sh |  7 +++++--
>>  t/t5510-fetch.sh         | 18 ++++++++++--------
>>  3 files changed, 22 insertions(+), 11 deletions(-)
>
> Thanks for fixing it, and sorry I didn't catch it during initial
> review.
> ...
>> diff --git a/builtin/fetch.c b/builtin/fetch.c
>> index 320ba9471d..c6c4689250 100644
>> --- a/builtin/fetch.c
>> +++ b/builtin/fetch.c
>> @@ -1023,11 +1023,17 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
>>  				rc |= update_local_ref(ref, what, rm, &note,
>>  						       summary_width);
>>  				free(ref);
>> -			} else
>> +			} else if (write_fetch_head || dry_run) {
>> +				/*
>> +				 * Display fetches written to FETCH_HEAD (or
>> +				 * would be written to FETCH_HEAD, if --dry-run
>
> nit: to fix the parallel construction, s/would/that would/ or
> s/written/that were written/

True.

>> +				 * is set).
>> +				 */
>>  				format_display(&note, '*',
>>  					       *kind ? kind : "branch", NULL,
>>  					       *what ? what : "HEAD",
>>  					       "FETCH_HEAD", summary_width);
>> +			}

Strictly speaking, I suspect that this is still broken when the user
says "fetch --no-write-fetch-head --dry-run" in which case we should
skip this block.

And to fix it properly, we would probably need to keep track of
three things semi-independently.

 - were we told this is a "dry-run"? (current 'dry_run' variable)

 - were we told not to store fetch-head? (missing)

 - after all, are we going to write or not write fetch-head (current
   'write_fetch_head' variable)

And the conditional to protect this block would be fixed to use only
the second and new "have we seen --no-fetch-head on the command
line?" variable, and ignore the settings of the dry_run variable, I
think.

Thanks.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux