All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v3 3/4] get rid of "git submodule summary --for-status"
Date: Thu, 29 Aug 2013 23:05:52 +0200	[thread overview]
Message-ID: <vpqr4dcnr67.fsf@anie.imag.fr> (raw)
In-Reply-To: <xmqqsixs2run.fsf@gitster.dls.corp.google.com> (Junio C. Hamano's message of "Thu, 29 Aug 2013 12:56:48 -0700")

Junio C Hamano <gitster@pobox.com> writes:

> Matthieu Moy <Matthieu.Moy@imag.fr> writes:
>
>> +	/* prepend header, only if there's an actual output */
>> +	if (len) {
>> +		if (uncommitted)
>> +			strbuf_addstr(&summary, _("Submodules changed but not updated:"));
>> +		else
>> +			strbuf_addstr(&summary, _("Submodule changes to be committed:"));
>> +		strbuf_addstr(&summary, "\n\n");
>> +	}
>> +	strbuf_addbuf(&summary, &cmd_stdout);
>> +	strbuf_release(&cmd_stdout);
>> +
>> +	summary_content = strbuf_detach(&summary, &len);
>> +	strbuf_add_commented_lines(&summary, summary_content, len);
>> +	free(summary_content);
>> +
>> +	summary_content = strbuf_detach(&summary, &len);
>> +	fprintf(s->fp, summary_content);
>> +	free(summary_content);
>
> This "fprintf()" looks bogus to me.

Oops, indeed. I forgot the "%s".

> How about adding this on top?

Your solution is better, yes.

>  wt-status.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/wt-status.c b/wt-status.c
> index d91661d..1f17652 100644
> --- a/wt-status.c
> +++ b/wt-status.c
> @@ -710,9 +710,8 @@ static void wt_status_print_submodule_summary(struct wt_status *s, int uncommitt
>  	strbuf_add_commented_lines(&summary, summary_content, len);
>  	free(summary_content);
>  
> -	summary_content = strbuf_detach(&summary, &len);
> -	fprintf(s->fp, summary_content);
> -	free(summary_content);
> +	fputs(summary.buf, s->fp);
> +	strbuf_release(&summary);
>  }
>  
>  static void wt_status_print_other(struct wt_status *s,

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

  reply	other threads:[~2013-08-29 21:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-29 13:05 [RFC/PATCH v3 0/4] Disable "git status" comment prefix Matthieu Moy
2013-08-29 13:05 ` [PATCH v3 1/4] builtin/stripspace.c: fix broken indentation Matthieu Moy
2013-08-29 13:05 ` [PATCH v3 2/4] wt-status: use argv_array API Matthieu Moy
2013-08-29 13:05 ` [PATCH v3 3/4] get rid of "git submodule summary --for-status" Matthieu Moy
2013-08-29 19:54   ` Jens Lehmann
2013-08-29 21:23     ` Matthieu Moy
2013-08-30 19:40       ` Jens Lehmann
2013-08-30 19:51         ` Jens Lehmann
2013-08-30 20:08           ` Jens Lehmann
2013-08-31 17:08             ` brian m. carlson
2013-09-01 13:47               ` Jens Lehmann
2013-09-03 19:32     ` Jens Lehmann
2013-08-29 19:56   ` Junio C Hamano
2013-08-29 21:05     ` Matthieu Moy [this message]
2013-08-29 13:05 ` [PATCH v3 4/4] status: introduce status.displayCommentChar to disable display of # Matthieu Moy
2013-08-29 16:19 ` [RFC/PATCH v3 0/4] Disable "git status" comment prefix Junio C Hamano

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=vpqr4dcnr67.fsf@anie.imag.fr \
    --to=matthieu.moy@grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.