@@ -660,12 +660,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
660660 step((generator = generator.apply(thisArg, _arguments || [])).next());
661661 });
662662};
663+ var __importDefault = (this && this.__importDefault) || function (mod) {
664+ return (mod && mod.__esModule) ? mod : { "default": mod };
665+ };
663666Object.defineProperty(exports, "__esModule", ({ value: true }));
664667exports.GitCommandManager = void 0;
665668const exec = __importStar(__nccwpck_require__(5236));
666669const io = __importStar(__nccwpck_require__(4994));
667670const utils = __importStar(__nccwpck_require__(9277));
668671const path = __importStar(__nccwpck_require__(6928));
672+ const stream_1 = __importDefault(__nccwpck_require__(2203));
669673const tagsRefSpec = '+refs/tags/*:refs/tags/*';
670674class GitCommandManager {
671675 constructor(workingDirectory, gitPath) {
@@ -781,7 +785,7 @@ class GitCommandManager {
781785 '--no-abbrev',
782786 `--format=%H%n%T%n%P%n%G?%n%s%n%b%n${endOfBody}`,
783787 ref
784- ]);
788+ ], { suppressGitCmdOutput: true } );
785789 const lines = output.stdout.split('\n');
786790 const endOfBodyIndex = lines.lastIndexOf(endOfBody);
787791 const detailLines = lines.slice(0, endOfBodyIndex);
@@ -895,7 +899,10 @@ class GitCommandManager {
895899 showFileAtRefBase64(ref, path) {
896900 return __awaiter(this, void 0, void 0, function* () {
897901 const args = ['show', `${ref}:${path}`];
898- const output = yield this.exec(args, { encoding: 'base64' });
902+ const output = yield this.exec(args, {
903+ encoding: 'base64',
904+ suppressGitCmdOutput: true
905+ });
899906 return output.stdout.trim();
900907 });
901908 }
@@ -964,8 +971,12 @@ class GitCommandManager {
964971 });
965972 }
966973 exec(args_1) {
967- return __awaiter(this, arguments, void 0, function* (args, { encoding = 'utf8', allowAllExitCodes = false } = {}) {
974+ return __awaiter(this, arguments, void 0, function* (args, { encoding = 'utf8', allowAllExitCodes = false, suppressGitCmdOutput = false } = {}) {
968975 const result = new GitOutput();
976+ if (process.env['CPR_SHOW_GIT_CMD_OUTPUT']) {
977+ // debug mode overrides the suppressGitCmdOutput option
978+ suppressGitCmdOutput = false;
979+ }
969980 const env = {};
970981 for (const key of Object.keys(process.env)) {
971982 env[key] = process.env[key];
@@ -987,7 +998,9 @@ class GitCommandManager {
987998 stderr.push(data);
988999 stderrLength += data.length;
9891000 }
990- }
1001+ },
1002+ outStream: outStreamHandler(process.stdout, suppressGitCmdOutput),
1003+ errStream: outStreamHandler(process.stderr, suppressGitCmdOutput)
9911004 };
9921005 result.exitCode = yield exec.exec(`"${this.gitPath}"`, args, options);
9931006 result.stdout = Buffer.concat(stdout, stdoutLength).toString(encoding);
@@ -1004,6 +1017,24 @@ class GitOutput {
10041017 this.exitCode = 0;
10051018 }
10061019}
1020+ const outStreamHandler = (outStream, suppressGitCmdOutput) => {
1021+ return new stream_1.default.Writable({
1022+ write(chunk, _, next) {
1023+ if (suppressGitCmdOutput) {
1024+ const lines = chunk.toString().trimEnd().split('\n');
1025+ for (const line of lines) {
1026+ if (line.startsWith('[command]')) {
1027+ outStream.write(`${line}\n`);
1028+ }
1029+ }
1030+ }
1031+ else {
1032+ outStream.write(chunk);
1033+ }
1034+ next();
1035+ }
1036+ });
1037+ };
10071038
10081039
10091040/***/ }),
0 commit comments