* fix(dolt): scrub stderr-directed git tracing before git-remote transfers
Dolt's git blobstore drives git plumbing through a runner that captures
stdout and stderr into a single buffer and parses object ids out of the
result (store/blobstore/internal/git/runner.go). Any stderr chatter
therefore corrupts every captured value: with GIT_TRACE=1 in the
environment, bd dolt push/fetch/clone against a git+ remote dies with
"failed to get remote db", and the credential hints Dolt appends to the
error point the user at auth instead of tracing. #3996 fixed the same
combined-output class in bd's own git helpers, but the vendored Dolt
runner is out of reach.
What bd can do is keep the poison out of the environment the runner
inherits. New internal/gittraceenv knows the GIT_TRACE* family and
strips only stderr-directed values: absolute-path targets
(GIT_TRACE=/tmp/log) and trace2 af_unix: sockets keep working, and
disabled values (0/false/empty) are left alone. Like githooksenv it
refcounts a process-wide scope so concurrent remote ops nest safely.
Wiring mirrors #5186: the in-process CALL DOLT_PUSH/FETCH/CLONE path
gets the scrub through a single withRemoteEnvGuards helper in
versioncontrolops, which now owns both env guards so a call site cannot
pick up one and silently miss the other, and the dolt CLI fallback
scrubs the child environment in prepareDoltCLITransferCommand.
Repro on stock bd, any git+file remote: GIT_TRACE=1 bd dolt push fails
every time; with this change the traced and untraced pushes both pass.
* fix(dolt): close git-trace scrub gaps from review
The scrub covered the in-process engine path and the dolt CLI transfer
route, but three subprocess spawns still inherited stderr-directed git
tracing, and the value classifier accepted af_unix: targets for
variables that do not support them.
- githooksenv gains DisabledEnv, the subprocess-env counterpart of
WithDisabled, with exec last-wins replace semantics. Combined with
gittraceenv.ScrubEnv it forms the guarded env every dolt spawn that
can touch a git-protocol remote needs, so a spawn site cannot pick up
one guard and miss the other.
- Server spawns: the directly-managed sql-server spawn and the proxied
one now build their child env through a shared
doltserver.ServerSpawnEnv(). A server auto-started from a shell
carrying GIT_TRACE=1 no longer poisons every server-side git-protocol
transfer until restart.
- Bootstrap clone: BootstrapFromRemoteWithDB spawns dolt clone via
bootstrapCloneCmd with the guarded env; it does not route through
prepareDoltCLITransferCommand, so it needs the guards itself.
- remotecache: cross-rig cache push/clone/pull spawn dolt through one
doltCmd choke point with the guarded env; previously all three
inherited the caller's environment with neither guard.
- Classifier: stderrDirected is name-aware; af_unix:[<mode>:]<path> is
a file target only for the GIT_TRACE2 family, so GIT_TRACE=af_unix:...
is now scrubbed instead of drawing "warning: unknown trace value" on
stderr per plumbing call. On Windows, env names match
case-insensitively (Set Git_Trace=1 enables tracing in the child all
the same) and a leading dir separator counts as a file target, the
way git's is_absolute_path reads it.
- domain/db: the dormant Fetch/Push/Pull/Clone verbs get a comment
routing future wiring to the right guard site. The Runner behind this
repository is a connection to the sql-server, so the git plumbing
spawns from the server's environment — process-env guards in bd would
be inert here; ServerSpawnEnv at spawn time is the protection.
Regression tests assert the guarded env at each spawn site (effective
GIT_CONFIG_PARAMETERS via last-wins Extract), the survival of
file-target tracing, and the classifier table including the Windows
name/path semantics.
---------
Co-authored-by: Steve Yegge <steve.yegge@gmail.com>