All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Jeff King" <peff@peff.net>
Subject: Re: [PATCH 5/5] commit, status: use status_printf{,_ln,_more} helpers
Date: Sun, 27 Feb 2011 03:50:37 -0600	[thread overview]
Message-ID: <20110227095022.GB24391@elie> (raw)
In-Reply-To: <7vaahh6dw0.fsf@alter.siamese.dyndns.org>

Junio C Hamano wrote:
> Jonathan Nieder <jrnieder@gmail.com> 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

      reply	other threads:[~2011-02-27  9:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-26  5:07 [PATCH/RFC 0/5] status, commit: separate "# " from the translatable part of output Jonathan Nieder
2011-02-26  5:08 ` [PATCH 1/5] compat: provide a fallback va_copy definition Jonathan Nieder
2011-02-26  5:08 ` [PATCH 2/5] strbuf: add strbuf_vaddf Jonathan Nieder
2011-02-26  5:09 ` [PATCH 3/5] wt-status: add helpers for printing wt-status lines Jonathan Nieder
2011-02-26  5:10 ` [PATCH 4/5] commit: refer to commit template as s->fp Jonathan Nieder
2011-02-26  5:11 ` [PATCH 5/5] commit, status: use status_printf{,_ln,_more} helpers Jonathan Nieder
2011-02-27  9:11   ` Junio C Hamano
2011-02-27  9:50     ` Jonathan Nieder [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110227095022.GB24391@elie \
    --to=jrnieder@gmail.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.