danger
Version:
Unit tests for Team Culture
24 lines • 1.03 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.localGetFileAtSHA = void 0;
var debug_1 = require("../../debug");
var child_process_1 = require("child_process");
var d = (0, debug_1.debug)("localGetFileAtSHA");
var localGetFileAtSHA = function (path, _repo, sha) {
return new Promise(function (done) {
// Use execFile with an argv array (no shell) so that file paths containing
// shell metacharacters or quotes cannot break out and inject commands.
var args = ["show", "".concat(sha, ":").concat(path)];
d("git ".concat(args.join(" ")));
(0, child_process_1.execFile)("git", args, function (err, stdout, _stderr) {
if (err) {
console.error("Could not get the file ".concat(path, " from git at ").concat(sha));
console.error(err);
return;
}
done(stdout);
});
});
};
exports.localGetFileAtSHA = localGetFileAtSHA;
//# sourceMappingURL=localGetFileAtSHA.js.map