Subject: Re: [PATCH 3/7] strbuf: introduce strbuf_read_cmd helper

From: Jeff King <[email-masked]>
Date: Sun, 22 Mar 2015 19:34:49 -0400

On Sun, Mar 22, 2015 at 03:36:01PM -0400, Eric Sunshine wrote:

> > This is really at the intersection of the strbuf and
> > run-command APIs, so you could argue for it being part of
> > either It is logically quite like the strbuf_read_file()
> > function, so I put it there.
> 
> It does feel like a layering violation. If moved to the run-command
> API, it could given one of the following names or something better:

A layering violation implies there is an ordering to the APIs. Certainly
we call APIs from other APIs all the time. I guess you could argue that
these are the "same" layer, and should be next to each, and not building
on each other (i.e., that strbuf has dependencies only on system APIs
like stdio.h, and run-command only on system APIs like unistd.h, etc).

But then reversing the order of the dependency does not really solve
that. You would have to introduce a new higher-level API that combines
them. But that seems silly for a single function (and I do not foresee
any other similar functions).

That being said, I'm not opposed to one of the reverse names if people
feel strongly (I also considered making it an option flag to
run_command_v_opt, but it ended up tangling things quite a bit more).

-Peff