Re: [PATCH v8 3/6] remote set-head: better output for --auto

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

 



On Tue Oct 15, 2024 at 09:47, karthik nayak <karthik.188@xxxxxxxxx> wrote:
> Bence Ferdinandy <bence@xxxxxxxxxxxxxx> writes:
>
> [snip]
>
>> +static void report_set_head_auto(const char *remote, const char *head_name,
>> +			struct strbuf *buf_prev) {
>> +	struct strbuf buf_prefix = STRBUF_INIT;
>> +	const char *prev_head = NULL;
>> +
>> +	strbuf_addf(&buf_prefix, "refs/remotes/%s/", remote);
>> +	skip_prefix(buf_prev->buf, buf_prefix.buf, &prev_head);
>> +
>> +	if (prev_head && !strcmp(prev_head, head_name))
>> +		printf("'%s/HEAD' is unchanged and points to '%s'\n",
>> +			remote, head_name);
>> +	else if (prev_head)
>> +		printf("'%s/HEAD' has changed from '%s' and now points to '%s'\n",
>> +			remote, prev_head, head_name);
>> +	else if (!buf_prev->len)
>> +		printf("'%s/HEAD' is now created and points to '%s'\n",
>> +			remote, head_name);
>> +	else
>> +		printf("'%s/HEAD' used to point to '%s' "
>> +			"(which is not a remote branch), but now points to '%s'\n",
>> +			remote, buf_prev->buf, head_name);
>> +	strbuf_release(&buf_prefix);
>> +}
>> +
>
> Shouldn't the messages above be marked for translation too? using `_()`?

I guess it is unlikely to fall under the "should be machine readable" category.
I'll fix that up as well.

>
>>  static int set_head(int argc, const char **argv, const char *prefix)
>>  {
>>  	int i, opt_a = 0, opt_d = 0, result = 0;
>> -	struct strbuf buf = STRBUF_INIT, buf2 = STRBUF_INIT;
>> +	struct strbuf buf = STRBUF_INIT, buf2 = STRBUF_INIT,
>> +		buf_prev = STRBUF_INIT;
>
> Nit: these names could definitely be better.

Indeed ... The second patch is a refactor of remote set-head, I could include
a variable rename refactor there as well, and use the same names I used in the
last patch when adding the similar calls to fetch's set_head.






[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