git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 3/4] get rid of "git submodule summary --for-status"

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 29, 2013, 19:56 UTC
Message-ID
<xmqqsixs2run.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1377781536-31955-4-git-send-email-Matthieu.Moy@imag.fr>
Matthieu Moy <Matthieu.Moy@imag.fr> writes:
Show 18 quoted lines
> +	/* 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.  How about adding this on top?
 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,
Previous: Jens LehmannNext: Matthieu Moy
Message 13 of 16 in “Disable "git status" comment prefix”
  1. 0/4 Disable "git status" comment prefixMatthieu Moy, Aug 29, 2013
  2. 1/4 builtin/stripspace.c: fix broken indentationMatthieu Moy, Aug 29, 2013
  3. 2/4 wt-status: use argv_array APIMatthieu Moy, Aug 29, 2013
  4. 3/4 get rid of "git submodule summary --for-status"Matthieu Moy, Aug 29, 2013
  5. Jens LehmannAug 29, 2013
  6. Matthieu MoyAug 29, 2013
  7. Jens LehmannAug 30, 2013
  8. Jens LehmannAug 30, 2013
  9. Jens LehmannAug 30, 2013
  10. brian m. carlsonAug 31, 2013
  11. Jens LehmannSep 1, 2013
  12. Jens LehmannSep 3, 2013
  13. Junio C HamanoAug 29, 2013
  14. Matthieu MoyAug 29, 2013
  15. 4/4 status: introduce status.displayCommentChar to disable display of #Matthieu Moy, Aug 29, 2013
  16. Junio C HamanoAug 29, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.