Re: [PATCH 5/5] commit, status: use status_printf{,_ln,_more} helpers

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

 



Junio C Hamano wrote:
> Jonathan Nieder <jrnieder@xxxxxxxxx> writes:

>> +++ b/builtin/commit.c
>> @@ -694,50 +694,51 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
>>  	if (use_editor && include_status) {
>>  		char *ai_tmp, *ci_tmp;
>>  		if (in_merge)
>> -...
>> +			status_printf_ln(s, GIT_COLOR_NORMAL,
>> +				"\n"
>> +				"It looks like you may be committing a MERGE.\n"
>> +				"If this is not correct, please remove the file\n"
>> +				"	%s\n"
>> +				"and try again.\n"
>> +				"",
>
> This trick to avoid difference-in-comma-when-updated was semi "Huh" when
> reading.  Is it worth it?

The hint starts and ends with a blank (commented) line.

			status_printf(s, GIT_COLOR_NORMAL,
				"\n"
				...
				"and try again.\n"
				"\n",

would be clearer.

> The "attribute((format))" safety seems to bite us here...
>
>     $ Meta/Make --pedantic builtin/commit.o
>         CC builtin/commit.o
>     cc1: warnings being treated as errors
>     builtin/commit.c: In function 'prepare_to_commit':
>     builtin/commit.c:741: error: zero-length printf format string
>
> In wt-status.c many similar ones exist, unfortunately.

What a warning. :)  I don't understand how it is supposed to benefit
the world[1].

	status_printf_ln(s, GIT_COLOR_NORMAL, "%s", "");
	status_printf(s, GIT_COLOR_NORMAL, "\n");

I suppose the latter could be a bearable workaround.

[1] http://gcc.gnu.org/ml/gcc-patches/2002-05/msg01462.html
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]