On Thu, Oct 20, 2016 at 2:38 PM, Jeff King <peff@xxxxxxxx> wrote: > On Thu, Oct 20, 2016 at 12:54:32PM -0700, Stefan Beller wrote: > >> Maybe we should stop introducing un-optimized tests. >> [...] >> * heavy use of the "git -C <dir>" pattern. When applying that >> thouroughly we'd save spanning the subshells. > > Yeah, I imagine with some style changes we could drop quite a few > subshells. The problem is that the conversion work is manual and > tedious. I'd look first for spots where we can eliminate thousands of > calls with a single change. > >> That said I really like the idea of having a helper that would eliminate the cat >> for you, e.g. : >> >> git_test_helper_equal_stdin_or_diff_and_die -C super_repo status >> --porcelain=v2 --branch --untracked-files=all <<-EOF >> 1 A. N... 000000 100644 100644 $_z40 $HMOD .gitmodules >> 1 AM S.M. 000000 160000 160000 $_z40 $HSUP sub1 >> EOF > > I think that helper still ends up using "cat" and "diff" under the hood, I assumed that helper being a C program, that only needs to fork once for the actual git call and then it sits idle to compare the exact output from stdout to its stdin. If there is a difference it will do the extra work (i.e. put stdin and stout to a file and call diff on it)