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

Re: [PATCH RFC] diff: add SUBMODULE_DIFF format to display submodule diff

From
Johannes Sixt <j6t@kdbg.org>
Date
Aug 10, 2016, 19:41 UTC
Message-ID
<b44c853f-2b4b-0eeb-ba1a-df0e650f7868@kdbg.org>
In-Reply-To
<CA+P7+xqnALzwkgLXrP57BUtFGaxGudAEG7cmGTakP47ofFEjHQ@mail.gmail.com>
Am 10.08.2016 um 00:56 schrieb Jacob Keller:
Show 10 quoted lines
> On Tue, Aug 9, 2016 at 3:50 PM, Stefan Beller <sbeller@google.com> wrote:
>> On Tue, Aug 9, 2016 at 3:32 PM, Jacob Keller <jacob.e.keller@intel.com> wrote:
>>> +       if (strbuf_read(buf, cp.out, 0) < 0)
>>
>> So we keep the whole diff in memory
>> I don't know much about the diff machinery, but I thought
>> the rest of the diff machinery just streams it out?
>
> Yea, but I can't figure out how to do that. Is there an easy way to
> stream chunks from the pipe straight into the file?

You don't stream via a pipe, you let the sub-process write directly to the file:

	fflush(f);
	cp.out = dup(fileno(f));

Of course, you no longer "prepare_submodule_diff" anymore (which currently runs the child process), but you print the "Submodule" header line, then invoke the child process, and if there was a failure, you fprintf(f, "(diff failed)").

-- Hannes
Previous: Stefan Beller
Message 7 of 7 in “diff: add SUBMODULE_DIFF format to display submodule diff”
  1. diff: add SUBMODULE_DIFF format to display submodule diffJacob Keller, Aug 9, 2016
  2. Junio C HamanoAug 9, 2016
  3. Stefan BellerAug 9, 2016
  4. Jacob KellerAug 9, 2016
  5. Stefan BellerAug 9, 2016
  6. Stefan BellerAug 9, 2016
  7. Johannes SixtAug 10, 2016

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.