Add timestamp and execution time to Git log

This commit is contained in:
Ladislau Szomoru
2021-12-09 15:18:22 +01:00
parent 9af3dc35d3
commit 452e2c5303
7 changed files with 35 additions and 30 deletions

View File

@@ -531,10 +531,15 @@ export class Git {
child.stdin!.end(options.input, 'utf8');
}
const startTime = Date.now();
const bufferResult = await exec(child, options.cancellationToken);
if (options.log !== false && bufferResult.stderr.length > 0) {
this.log(`${bufferResult.stderr}\n`);
if (options.log !== false) {
this.log(`> git ${args.join(' ')} [${Date.now() - startTime}ms]\n`);
if (bufferResult.stderr.length > 0) {
this.log(`${bufferResult.stderr}\n`);
}
}
let encoding = options.encoding || 'utf8';
@@ -585,10 +590,6 @@ export class Git {
options.cwd = sanitizePath(options.cwd);
}
if (options.log !== false) {
this.log(`> git ${args.join(' ')}\n`);
}
return cp.spawn(this.path, args, options);
}