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
Stefan Beller <sbeller@google.com>
Date
Aug 9, 2016, 23:10 UTC
Message-ID
<CAGZ79kZbHAsxf9G-8=nz3o_zOMNFPa=kSphdo=4zLq97jycbYg@mail.gmail.com>
In-Reply-To
<CA+P7+xqnALzwkgLXrP57BUtFGaxGudAEG7cmGTakP47ofFEjHQ@mail.gmail.com>
On Tue, Aug 9, 2016 at 3:56 PM, Jacob Keller <jacob.keller@gmail.com> wrote:
Show 9 quoted lines
>>> +
>>> +       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?
Maybe, roughly:
    cp.stdout = -1;
    start_command(&cp);
    do {
        int r = xread(cp.stdout, buf, MAX_IO_SIZE);
    } while (r >=0);
    finish_command(&cp);

xread does use a poll() for you so it is not active polling, but only reading when data is available.

Show 8 quoted lines
>>
>> When not checked out, we can invoke the diff command
>> in .git/modules/<name> as that is the git dir of the submodule,
>> i.e. operating diff with a bare repo?
>
> We can actually do this every time. How would you pass that in a
> child_process? I don't think it's "dir" but instead passing
> "--git-dir" somehow?
git -C $GIT_DIR diff --relative ${superprojects ce->name}

with $GIT_DIR = ${SUPERPROJECTS GITDIR + modules/<name>/ with name to be looked as submodule_from_path(ce->name) and then taking `name` from the submodule struct)

Thanks, Stefan

Previous: Jacob KellerNext: Stefan Beller
Message 5 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.