On Fri, Dec 11, 2020 at 09:27:57AM -0500, Jeff King wrote: > On Fri, Dec 11, 2020 at 02:35:01PM +0100, Patrick Steinhardt wrote: > > > > E.g. IIRC this whole series is because it's a hassle to invoke > > > core.askpass in some stateful program where you'd like to just provide a > > > transitory password. I think some brief cross-linking or explanation > > > somewhere of these various ways to pass sensitive values around would be > > > relly helpful. > > > > It had been the original intention, yes. And it still is, but in fact > > the usecase has broadened to also use it to get rid of our global git > > config in Gitaly. Which is a little bit awkward to do with > > `--config-env` or `-c`, as now a ps(1) would first show a dozen of > > configuration values only to have the real command buried somewhere at > > the back. It would have been easy to implement though with the > > GIT_CONFIG_ envvars. > > I don't know what kinds of variables you want to set exactly, but > another possible option here is some mechanism to point Git to an extra > config file. This would work if you are setting a bunch of options in > some static way, but not if you're setting them to custom values for > each command invocation (because then you'd be dealing with a temp file, > which is annoying and error-prone). > > I'm thinking something like a $GIT_CONFIG_ENV_FILE that is parsed after > repo config but before $GIT_CONFIG_PARAMETERS. > > Or alternatively, add an includeIf directive that lets you do something > like: > > [includeIf "env:FOO"] > path = foo.gitconfig > > which triggers if $FOO is set. But again, that's only useful if you have > certain "profiles" of config you're trying to set, and not custom > values. > > -Peff The issue we have is that the config file isn't necessarily under our control. It is in most cases, like e.g. when Gitaly gets deployed via Omnibus. But we also allow for source-based installations, where the user configures most things manually. And in that case, we have to ask the user to "Please set config variables A, B and C". Naturally, this is easy to forget, will drift apart in future releases and so on. To fix this, the plan is to move all required configuration items into Gitaly itself, which GIT_CONFIG_COUNT would've allowd to do quite nicely. Something like Ævar's proposal to allow reading the config from a file descriptor would also work, and just putting the whole configuration into an environment variable (similar to your GIT_CONFIG_ENV_FILE, but containing contents instead of a path). And finally, using `-c` would also work, with the downside of making it harder to see what's going on with all the git processes. With regards to what we require from the config, you can have a look e.g. at [1]. It doesn't contain much, but we expect the following ones to be set: - core.autocrlf=input - gc.auto=0 - repack.writeBitmaps=true - receive.advertisePushOptions=true - core.fsyncObjectFiles=true Anyway, this is all rather specific to Gitaly and may thus not be too interesting for other. So in the end, we'll just live with the tradeoffs of whatever solution we end up with. Patrick [1]: https://docs.gitlab.com/ee/install/installation.html#configure-it