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