From: Stefan Beller Date: Tue, 09 Aug 2016 23:10:53 GMT Subject: Re: [PATCH RFC] diff: add SUBMODULE_DIFF format to display submodule diff Message-ID: In-Reply-To: On Tue, Aug 9, 2016 at 3:56 PM, Jacob Keller 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? 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. >> >> When not checked out, we can invoke the diff command >> in .git/modules/ 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// with name to be looked as submodule_from_path(ce->name) and then taking `name` from the submodule struct) Thanks, Stefan