run method
Runs git [args] with workingDirectory as the cwd. The implementation
MUST strip the gitEnvBlacklist keys from the inherited environment
before exec (gc's clean-env build, git.go:314-320) so a parent
GIT_DIR/GIT_WORK_TREE/… from a melos/hook context can never redirect
the command to the wrong repository. Never throws — a launch failure is
reported as GitRunResult.launched == false.
Implementation
@override
Future<GitRunResult> run({
required String workingDirectory,
required List<String> args,
}) async {
// The GitOps root probe — answered as a work-tree ROOT and NOT recorded, so
// `calls`/`subcommands` stay the land argv the tests assert on. The answer
// ignores [exitCode] on purpose: a test that scripts a land FAILURE must
// fail at commit or push, never at the guard.
if (args.length >= 2 &&
args.first == 'rev-parse' &&
args.contains('--show-toplevel')) {
return GitRunResult(exitCode: 0, output: '$workingDirectory\n\n');
}
calls.add((workDir: workingDirectory, args: List.unmodifiable(args)));
return GitRunResult(exitCode: exitCode, output: '');
}