diff options
Diffstat (limited to 'node_modules/simple-git/esm')
-rw-r--r-- | node_modules/simple-git/esm/index.js | 3763 | ||||
-rw-r--r-- | node_modules/simple-git/esm/index.js.map | 7 | ||||
-rw-r--r-- | node_modules/simple-git/esm/package.json | 3 |
3 files changed, 3773 insertions, 0 deletions
diff --git a/node_modules/simple-git/esm/index.js b/node_modules/simple-git/esm/index.js new file mode 100644 index 0000000..4714cdb --- /dev/null +++ b/node_modules/simple-git/esm/index.js @@ -0,0 +1,3763 @@ +var __defProp = Object.defineProperty; +var __defProps = Object.defineProperties; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropDescs = Object.getOwnPropertyDescriptors; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getOwnPropSymbols = Object.getOwnPropertySymbols; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __propIsEnum = Object.prototype.propertyIsEnumerable; +var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; +var __spreadValues = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp.call(b, prop)) + __defNormalProp(a, prop, b[prop]); + if (__getOwnPropSymbols) + for (var prop of __getOwnPropSymbols(b)) { + if (__propIsEnum.call(b, prop)) + __defNormalProp(a, prop, b[prop]); + } + return a; +}; +var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); +var __markAsModule = (target) => __defProp(target, "__esModule", { value: true }); +var __esm = (fn, res) => function __init() { + return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; +}; +var __commonJS = (cb, mod) => function __require() { + return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; +}; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __reExport = (target, module, copyDefault, desc) => { + if (module && typeof module === "object" || typeof module === "function") { + for (let key of __getOwnPropNames(module)) + if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default")) + __defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable }); + } + return target; +}; +var __toCommonJS = /* @__PURE__ */ ((cache) => { + return (module, temp) => { + return cache && cache.get(module) || (temp = __reExport(__markAsModule({}), module, 1), cache && cache.set(module, temp), temp); + }; +})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0); +var __async = (__this, __arguments, generator) => { + return new Promise((resolve, reject) => { + var fulfilled = (value) => { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + }; + var rejected = (value) => { + try { + step(generator.throw(value)); + } catch (e) { + reject(e); + } + }; + var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); + step((generator = generator.apply(__this, __arguments)).next()); + }); +}; + +// src/lib/errors/git-error.ts +var GitError; +var init_git_error = __esm({ + "src/lib/errors/git-error.ts"() { + GitError = class extends Error { + constructor(task, message) { + super(message); + this.task = task; + Object.setPrototypeOf(this, new.target.prototype); + } + }; + } +}); + +// src/lib/errors/git-response-error.ts +var GitResponseError; +var init_git_response_error = __esm({ + "src/lib/errors/git-response-error.ts"() { + init_git_error(); + GitResponseError = class extends GitError { + constructor(git, message) { + super(void 0, message || String(git)); + this.git = git; + } + }; + } +}); + +// src/lib/errors/task-configuration-error.ts +var TaskConfigurationError; +var init_task_configuration_error = __esm({ + "src/lib/errors/task-configuration-error.ts"() { + init_git_error(); + TaskConfigurationError = class extends GitError { + constructor(message) { + super(void 0, message); + } + }; + } +}); + +// src/lib/utils/util.ts +import { exists, FOLDER } from "@kwsites/file-exists"; +function asFunction(source) { + return typeof source === "function" ? source : NOOP; +} +function isUserFunction(source) { + return typeof source === "function" && source !== NOOP; +} +function splitOn(input, char) { + const index = input.indexOf(char); + if (index <= 0) { + return [input, ""]; + } + return [ + input.substr(0, index), + input.substr(index + 1) + ]; +} +function first(input, offset = 0) { + return isArrayLike(input) && input.length > offset ? input[offset] : void 0; +} +function last(input, offset = 0) { + if (isArrayLike(input) && input.length > offset) { + return input[input.length - 1 - offset]; + } +} +function isArrayLike(input) { + return !!(input && typeof input.length === "number"); +} +function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") { + return input.split(separator).reduce((output, line) => { + const lineContent = trimmed2 ? line.trim() : line; + if (lineContent) { + output.push(lineContent); + } + return output; + }, []); +} +function forEachLineWithContent(input, callback) { + return toLinesWithContent(input, true).map((line) => callback(line)); +} +function folderExists(path) { + return exists(path, FOLDER); +} +function append(target, item) { + if (Array.isArray(target)) { + if (!target.includes(item)) { + target.push(item); + } + } else { + target.add(item); + } + return item; +} +function including(target, item) { + if (Array.isArray(target) && !target.includes(item)) { + target.push(item); + } + return target; +} +function remove(target, item) { + if (Array.isArray(target)) { + const index = target.indexOf(item); + if (index >= 0) { + target.splice(index, 1); + } + } else { + target.delete(item); + } + return item; +} +function asArray(source) { + return Array.isArray(source) ? source : [source]; +} +function asStringArray(source) { + return asArray(source).map(String); +} +function asNumber(source, onNaN = 0) { + if (source == null) { + return onNaN; + } + const num = parseInt(source, 10); + return isNaN(num) ? onNaN : num; +} +function prefixedArray(input, prefix) { + const output = []; + for (let i = 0, max = input.length; i < max; i++) { + output.push(prefix, input[i]); + } + return output; +} +function bufferToString(input) { + return (Array.isArray(input) ? Buffer.concat(input) : input).toString("utf-8"); +} +function pick(source, properties) { + return Object.assign({}, ...properties.map((property) => property in source ? { [property]: source[property] } : {})); +} +function delay(duration = 0) { + return new Promise((done) => setTimeout(done, duration)); +} +var NULL, NOOP, objectToString; +var init_util = __esm({ + "src/lib/utils/util.ts"() { + NULL = "\0"; + NOOP = () => { + }; + objectToString = Object.prototype.toString.call.bind(Object.prototype.toString); + } +}); + +// src/lib/utils/argument-filters.ts +function filterType(input, filter, def) { + if (filter(input)) { + return input; + } + return arguments.length > 2 ? def : void 0; +} +function filterPrimitives(input, omit) { + return /number|string|boolean/.test(typeof input) && (!omit || !omit.includes(typeof input)); +} +function filterPlainObject(input) { + return !!input && objectToString(input) === "[object Object]"; +} +function filterFunction(input) { + return typeof input === "function"; +} +var filterArray, filterString, filterStringArray, filterStringOrStringArray, filterHasLength; +var init_argument_filters = __esm({ + "src/lib/utils/argument-filters.ts"() { + init_util(); + filterArray = (input) => { + return Array.isArray(input); + }; + filterString = (input) => { + return typeof input === "string"; + }; + filterStringArray = (input) => { + return Array.isArray(input) && input.every(filterString); + }; + filterStringOrStringArray = (input) => { + return filterString(input) || Array.isArray(input) && input.every(filterString); + }; + filterHasLength = (input) => { + if (input == null || "number|boolean|function".includes(typeof input)) { + return false; + } + return Array.isArray(input) || typeof input === "string" || typeof input.length === "number"; + }; + } +}); + +// src/lib/utils/exit-codes.ts +var ExitCodes; +var init_exit_codes = __esm({ + "src/lib/utils/exit-codes.ts"() { + ExitCodes = /* @__PURE__ */ ((ExitCodes2) => { + ExitCodes2[ExitCodes2["SUCCESS"] = 0] = "SUCCESS"; + ExitCodes2[ExitCodes2["ERROR"] = 1] = "ERROR"; + ExitCodes2[ExitCodes2["UNCLEAN"] = 128] = "UNCLEAN"; + return ExitCodes2; + })(ExitCodes || {}); + } +}); + +// src/lib/utils/git-output-streams.ts +var GitOutputStreams; +var init_git_output_streams = __esm({ + "src/lib/utils/git-output-streams.ts"() { + GitOutputStreams = class { + constructor(stdOut, stdErr) { + this.stdOut = stdOut; + this.stdErr = stdErr; + } + asStrings() { + return new GitOutputStreams(this.stdOut.toString("utf8"), this.stdErr.toString("utf8")); + } + }; + } +}); + +// src/lib/utils/line-parser.ts +var LineParser, RemoteLineParser; +var init_line_parser = __esm({ + "src/lib/utils/line-parser.ts"() { + LineParser = class { + constructor(regExp, useMatches) { + this.matches = []; + this.parse = (line, target) => { + this.resetMatches(); + if (!this._regExp.every((reg, index) => this.addMatch(reg, index, line(index)))) { + return false; + } + return this.useMatches(target, this.prepareMatches()) !== false; + }; + this._regExp = Array.isArray(regExp) ? regExp : [regExp]; + if (useMatches) { + this.useMatches = useMatches; + } + } + useMatches(target, match) { + throw new Error(`LineParser:useMatches not implemented`); + } + resetMatches() { + this.matches.length = 0; + } + prepareMatches() { + return this.matches; + } + addMatch(reg, index, line) { + const matched = line && reg.exec(line); + if (matched) { + this.pushMatch(index, matched); + } + return !!matched; + } + pushMatch(_index, matched) { + this.matches.push(...matched.slice(1)); + } + }; + RemoteLineParser = class extends LineParser { + addMatch(reg, index, line) { + return /^remote:\s/.test(String(line)) && super.addMatch(reg, index, line); + } + pushMatch(index, matched) { + if (index > 0 || matched.length > 1) { + super.pushMatch(index, matched); + } + } + }; + } +}); + +// src/lib/utils/simple-git-options.ts +function createInstanceConfig(...options) { + const baseDir = process.cwd(); + const config = Object.assign(__spreadValues({ baseDir }, defaultOptions), ...options.filter((o) => typeof o === "object" && o)); + config.baseDir = config.baseDir || baseDir; + return config; +} +var defaultOptions; +var init_simple_git_options = __esm({ + "src/lib/utils/simple-git-options.ts"() { + defaultOptions = { + binary: "git", + maxConcurrentProcesses: 5, + config: [] + }; + } +}); + +// src/lib/utils/task-options.ts +function appendTaskOptions(options, commands = []) { + if (!filterPlainObject(options)) { + return commands; + } + return Object.keys(options).reduce((commands2, key) => { + const value = options[key]; + if (filterPrimitives(value, ["boolean"])) { + commands2.push(key + "=" + value); + } else { + commands2.push(key); + } + return commands2; + }, commands); +} +function getTrailingOptions(args, initialPrimitive = 0, objectOnly = false) { + const command = []; + for (let i = 0, max = initialPrimitive < 0 ? args.length : initialPrimitive; i < max; i++) { + if ("string|number".includes(typeof args[i])) { + command.push(String(args[i])); + } + } + appendTaskOptions(trailingOptionsArgument(args), command); + if (!objectOnly) { + command.push(...trailingArrayArgument(args)); + } + return command; +} +function trailingArrayArgument(args) { + const hasTrailingCallback = typeof last(args) === "function"; + return filterType(last(args, hasTrailingCallback ? 1 : 0), filterArray, []); +} +function trailingOptionsArgument(args) { + const hasTrailingCallback = filterFunction(last(args)); + return filterType(last(args, hasTrailingCallback ? 1 : 0), filterPlainObject); +} +function trailingFunctionArgument(args, includeNoop = true) { + const callback = asFunction(last(args)); + return includeNoop || isUserFunction(callback) ? callback : void 0; +} +var init_task_options = __esm({ + "src/lib/utils/task-options.ts"() { + init_argument_filters(); + init_util(); + } +}); + +// src/lib/utils/task-parser.ts +function callTaskParser(parser3, streams) { + return parser3(streams.stdOut, streams.stdErr); +} +function parseStringResponse(result, parsers11, ...texts) { + texts.forEach((text) => { + for (let lines = toLinesWithContent(text), i = 0, max = lines.length; i < max; i++) { + const line = (offset = 0) => { + if (i + offset >= max) { + return; + } + return lines[i + offset]; + }; + parsers11.some(({ parse }) => parse(line, result)); + } + }); + return result; +} +var init_task_parser = __esm({ + "src/lib/utils/task-parser.ts"() { + init_util(); + } +}); + +// src/lib/utils/index.ts +var utils_exports = {}; +__export(utils_exports, { + ExitCodes: () => ExitCodes, + GitOutputStreams: () => GitOutputStreams, + LineParser: () => LineParser, + NOOP: () => NOOP, + NULL: () => NULL, + RemoteLineParser: () => RemoteLineParser, + append: () => append, + appendTaskOptions: () => appendTaskOptions, + asArray: () => asArray, + asFunction: () => asFunction, + asNumber: () => asNumber, + asStringArray: () => asStringArray, + bufferToString: () => bufferToString, + callTaskParser: () => callTaskParser, + createInstanceConfig: () => createInstanceConfig, + delay: () => delay, + filterArray: () => filterArray, + filterFunction: () => filterFunction, + filterHasLength: () => filterHasLength, + filterPlainObject: () => filterPlainObject, + filterPrimitives: () => filterPrimitives, + filterString: () => filterString, + filterStringArray: () => filterStringArray, + filterStringOrStringArray: () => filterStringOrStringArray, + filterType: () => filterType, + first: () => first, + folderExists: () => folderExists, + forEachLineWithContent: () => forEachLineWithContent, + getTrailingOptions: () => getTrailingOptions, + including: () => including, + isUserFunction: () => isUserFunction, + last: () => last, + objectToString: () => objectToString, + parseStringResponse: () => parseStringResponse, + pick: () => pick, + prefixedArray: () => prefixedArray, + remove: () => remove, + splitOn: () => splitOn, + toLinesWithContent: () => toLinesWithContent, + trailingFunctionArgument: () => trailingFunctionArgument, + trailingOptionsArgument: () => trailingOptionsArgument +}); +var init_utils = __esm({ + "src/lib/utils/index.ts"() { + init_argument_filters(); + init_exit_codes(); + init_git_output_streams(); + init_line_parser(); + init_simple_git_options(); + init_task_options(); + init_task_parser(); + init_util(); + } +}); + +// src/lib/tasks/check-is-repo.ts +var check_is_repo_exports = {}; +__export(check_is_repo_exports, { + CheckRepoActions: () => CheckRepoActions, + checkIsBareRepoTask: () => checkIsBareRepoTask, + checkIsRepoRootTask: () => checkIsRepoRootTask, + checkIsRepoTask: () => checkIsRepoTask +}); +function checkIsRepoTask(action) { + switch (action) { + case "bare" /* BARE */: + return checkIsBareRepoTask(); + case "root" /* IS_REPO_ROOT */: + return checkIsRepoRootTask(); + } + const commands = ["rev-parse", "--is-inside-work-tree"]; + return { + commands, + format: "utf-8", + onError, + parser + }; +} +function checkIsRepoRootTask() { + const commands = ["rev-parse", "--git-dir"]; + return { + commands, + format: "utf-8", + onError, + parser(path) { + return /^\.(git)?$/.test(path.trim()); + } + }; +} +function checkIsBareRepoTask() { + const commands = ["rev-parse", "--is-bare-repository"]; + return { + commands, + format: "utf-8", + onError, + parser + }; +} +function isNotRepoMessage(error) { + return /(Not a git repository|Kein Git-Repository)/i.test(String(error)); +} +var CheckRepoActions, onError, parser; +var init_check_is_repo = __esm({ + "src/lib/tasks/check-is-repo.ts"() { + init_utils(); + CheckRepoActions = /* @__PURE__ */ ((CheckRepoActions2) => { + CheckRepoActions2["BARE"] = "bare"; + CheckRepoActions2["IN_TREE"] = "tree"; + CheckRepoActions2["IS_REPO_ROOT"] = "root"; + return CheckRepoActions2; + })(CheckRepoActions || {}); + onError = ({ exitCode }, error, done, fail) => { + if (exitCode === 128 /* UNCLEAN */ && isNotRepoMessage(error)) { + return done(Buffer.from("false")); + } + fail(error); + }; + parser = (text) => { + return text.trim() === "true"; + }; + } +}); + +// src/lib/responses/CleanSummary.ts +function cleanSummaryParser(dryRun, text) { + const summary = new CleanResponse(dryRun); + const regexp = dryRun ? dryRunRemovalRegexp : removalRegexp; + toLinesWithContent(text).forEach((line) => { + const removed = line.replace(regexp, ""); + summary.paths.push(removed); + (isFolderRegexp.test(removed) ? summary.folders : summary.files).push(removed); + }); + return summary; +} +var CleanResponse, removalRegexp, dryRunRemovalRegexp, isFolderRegexp; +var init_CleanSummary = __esm({ + "src/lib/responses/CleanSummary.ts"() { + init_utils(); + CleanResponse = class { + constructor(dryRun) { + this.dryRun = dryRun; + this.paths = []; + this.files = []; + this.folders = []; + } + }; + removalRegexp = /^[a-z]+\s*/i; + dryRunRemovalRegexp = /^[a-z]+\s+[a-z]+\s*/i; + isFolderRegexp = /\/$/; + } +}); + +// src/lib/tasks/task.ts +var task_exports = {}; +__export(task_exports, { + EMPTY_COMMANDS: () => EMPTY_COMMANDS, + adhocExecTask: () => adhocExecTask, + configurationErrorTask: () => configurationErrorTask, + isBufferTask: () => isBufferTask, + isEmptyTask: () => isEmptyTask, + straightThroughBufferTask: () => straightThroughBufferTask, + straightThroughStringTask: () => straightThroughStringTask +}); +function adhocExecTask(parser3) { + return { + commands: EMPTY_COMMANDS, + format: "empty", + parser: parser3 + }; +} +function configurationErrorTask(error) { + return { + commands: EMPTY_COMMANDS, + format: "empty", + parser() { + throw typeof error === "string" ? new TaskConfigurationError(error) : error; + } + }; +} +function straightThroughStringTask(commands, trimmed2 = false) { + return { + commands, + format: "utf-8", + parser(text) { + return trimmed2 ? String(text).trim() : text; + } + }; +} +function straightThroughBufferTask(commands) { + return { + commands, + format: "buffer", + parser(buffer) { + return buffer; + } + }; +} +function isBufferTask(task) { + return task.format === "buffer"; +} +function isEmptyTask(task) { + return task.format === "empty" || !task.commands.length; +} +var EMPTY_COMMANDS; +var init_task = __esm({ + "src/lib/tasks/task.ts"() { + init_task_configuration_error(); + EMPTY_COMMANDS = []; + } +}); + +// src/lib/tasks/clean.ts +var clean_exports = {}; +__export(clean_exports, { + CONFIG_ERROR_INTERACTIVE_MODE: () => CONFIG_ERROR_INTERACTIVE_MODE, + CONFIG_ERROR_MODE_REQUIRED: () => CONFIG_ERROR_MODE_REQUIRED, + CONFIG_ERROR_UNKNOWN_OPTION: () => CONFIG_ERROR_UNKNOWN_OPTION, + CleanOptions: () => CleanOptions, + cleanTask: () => cleanTask, + cleanWithOptionsTask: () => cleanWithOptionsTask, + isCleanOptionsArray: () => isCleanOptionsArray +}); +function cleanWithOptionsTask(mode, customArgs) { + const { cleanMode, options, valid } = getCleanOptions(mode); + if (!cleanMode) { + return configurationErrorTask(CONFIG_ERROR_MODE_REQUIRED); + } + if (!valid.options) { + return configurationErrorTask(CONFIG_ERROR_UNKNOWN_OPTION + JSON.stringify(mode)); + } + options.push(...customArgs); + if (options.some(isInteractiveMode)) { + return configurationErrorTask(CONFIG_ERROR_INTERACTIVE_MODE); + } + return cleanTask(cleanMode, options); +} +function cleanTask(mode, customArgs) { + const commands = ["clean", `-${mode}`, ...customArgs]; + return { + commands, + format: "utf-8", + parser(text) { + return cleanSummaryParser(mode === "n" /* DRY_RUN */, text); + } + }; +} +function isCleanOptionsArray(input) { + return Array.isArray(input) && input.every((test) => CleanOptionValues.has(test)); +} +function getCleanOptions(input) { + let cleanMode; + let options = []; + let valid = { cleanMode: false, options: true }; + input.replace(/[^a-z]i/g, "").split("").forEach((char) => { + if (isCleanMode(char)) { + cleanMode = char; + valid.cleanMode = true; + } else { + valid.options = valid.options && isKnownOption(options[options.length] = `-${char}`); + } + }); + return { + cleanMode, + options, + valid + }; +} +function isCleanMode(cleanMode) { + return cleanMode === "f" /* FORCE */ || cleanMode === "n" /* DRY_RUN */; +} +function isKnownOption(option) { + return /^-[a-z]$/i.test(option) && CleanOptionValues.has(option.charAt(1)); +} +function isInteractiveMode(option) { + if (/^-[^\-]/.test(option)) { + return option.indexOf("i") > 0; + } + return option === "--interactive"; +} +var CONFIG_ERROR_INTERACTIVE_MODE, CONFIG_ERROR_MODE_REQUIRED, CONFIG_ERROR_UNKNOWN_OPTION, CleanOptions, CleanOptionValues; +var init_clean = __esm({ + "src/lib/tasks/clean.ts"() { + init_CleanSummary(); + init_utils(); + init_task(); + CONFIG_ERROR_INTERACTIVE_MODE = "Git clean interactive mode is not supported"; + CONFIG_ERROR_MODE_REQUIRED = 'Git clean mode parameter ("n" or "f") is required'; + CONFIG_ERROR_UNKNOWN_OPTION = "Git clean unknown option found in: "; + CleanOptions = /* @__PURE__ */ ((CleanOptions2) => { + CleanOptions2["DRY_RUN"] = "n"; + CleanOptions2["FORCE"] = "f"; + CleanOptions2["IGNORED_INCLUDED"] = "x"; + CleanOptions2["IGNORED_ONLY"] = "X"; + CleanOptions2["EXCLUDING"] = "e"; + CleanOptions2["QUIET"] = "q"; + CleanOptions2["RECURSIVE"] = "d"; + return CleanOptions2; + })(CleanOptions || {}); + CleanOptionValues = /* @__PURE__ */ new Set(["i", ...asStringArray(Object.values(CleanOptions))]); + } +}); + +// src/lib/responses/ConfigList.ts +function configListParser(text) { + const config = new ConfigList(); + for (const item of configParser(text)) { + config.addValue(item.file, String(item.key), item.value); + } + return config; +} +function configGetParser(text, key) { + let value = null; + const values = []; + const scopes = /* @__PURE__ */ new Map(); + for (const item of configParser(text, key)) { + if (item.key !== key) { + continue; + } + values.push(value = item.value); + if (!scopes.has(item.file)) { + scopes.set(item.file, []); + } + scopes.get(item.file).push(value); + } + return { + key, + paths: Array.from(scopes.keys()), + scopes, + value, + values + }; +} +function configFilePath(filePath) { + return filePath.replace(/^(file):/, ""); +} +function* configParser(text, requestedKey = null) { + const lines = text.split("\0"); + for (let i = 0, max = lines.length - 1; i < max; ) { + const file = configFilePath(lines[i++]); + let value = lines[i++]; + let key = requestedKey; + if (value.includes("\n")) { + const line = splitOn(value, "\n"); + key = line[0]; + value = line[1]; + } + yield { file, key, value }; + } +} +var ConfigList; +var init_ConfigList = __esm({ + "src/lib/responses/ConfigList.ts"() { + init_utils(); + ConfigList = class { + constructor() { + this.files = []; + this.values = /* @__PURE__ */ Object.create(null); + } + get all() { + if (!this._all) { + this._all = this.files.reduce((all, file) => { + return Object.assign(all, this.values[file]); + }, {}); + } + return this._all; + } + addFile(file) { + if (!(file in this.values)) { + const latest = last(this.files); + this.values[file] = latest ? Object.create(this.values[latest]) : {}; + this.files.push(file); + } + return this.values[file]; + } + addValue(file, key, value) { + const values = this.addFile(file); + if (!values.hasOwnProperty(key)) { + values[key] = value; + } else if (Array.isArray(values[key])) { + values[key].push(value); + } else { + values[key] = [values[key], value]; + } + this._all = void 0; + } + }; + } +}); + +// src/lib/tasks/config.ts +function asConfigScope(scope, fallback) { + if (typeof scope === "string" && GitConfigScope.hasOwnProperty(scope)) { + return scope; + } + return fallback; +} +function addConfigTask(key, value, append2, scope) { + const commands = ["config", `--${scope}`]; + if (append2) { + commands.push("--add"); + } + commands.push(key, value); + return { + commands, + format: "utf-8", + parser(text) { + return text; + } + }; +} +function getConfigTask(key, scope) { + const commands = ["config", "--null", "--show-origin", "--get-all", key]; + if (scope) { + commands.splice(1, 0, `--${scope}`); + } + return { + commands, + format: "utf-8", + parser(text) { + return configGetParser(text, key); + } + }; +} +function listConfigTask(scope) { + const commands = ["config", "--list", "--show-origin", "--null"]; + if (scope) { + commands.push(`--${scope}`); + } + return { + commands, + format: "utf-8", + parser(text) { + return configListParser(text); + } + }; +} +function config_default() { + return { + addConfig(key, value, ...rest) { + return this._runTask(addConfigTask(key, value, rest[0] === true, asConfigScope(rest[1], "local" /* local */)), trailingFunctionArgument(arguments)); + }, + getConfig(key, scope) { + return this._runTask(getConfigTask(key, asConfigScope(scope, void 0)), trailingFunctionArgument(arguments)); + }, + listConfig(...rest) { + return this._runTask(listConfigTask(asConfigScope(rest[0], void 0)), trailingFunctionArgument(arguments)); + } + }; +} +var GitConfigScope; +var init_config = __esm({ + "src/lib/tasks/config.ts"() { + init_ConfigList(); + init_utils(); + GitConfigScope = /* @__PURE__ */ ((GitConfigScope2) => { + GitConfigScope2["system"] = "system"; + GitConfigScope2["global"] = "global"; + GitConfigScope2["local"] = "local"; + GitConfigScope2["worktree"] = "worktree"; + return GitConfigScope2; + })(GitConfigScope || {}); + } +}); + +// src/lib/tasks/grep.ts +function grepQueryBuilder(...params) { + return new GrepQuery().param(...params); +} +function parseGrep(grep) { + const paths = /* @__PURE__ */ new Set(); + const results = {}; + forEachLineWithContent(grep, (input) => { + const [path, line, preview] = input.split(NULL); + paths.add(path); + (results[path] = results[path] || []).push({ + line: asNumber(line), + path, + preview + }); + }); + return { + paths, + results + }; +} +function grep_default() { + return { + grep(searchTerm) { + const then = trailingFunctionArgument(arguments); + const options = getTrailingOptions(arguments); + for (const option of disallowedOptions) { + if (options.includes(option)) { + return this._runTask(configurationErrorTask(`git.grep: use of "${option}" is not supported.`), then); + } + } + if (typeof searchTerm === "string") { + searchTerm = grepQueryBuilder().param(searchTerm); + } + const commands = ["grep", "--null", "-n", "--full-name", ...options, ...searchTerm]; + return this._runTask({ + commands, + format: "utf-8", + parser(stdOut) { + return parseGrep(stdOut); + } + }, then); + } + }; +} +var disallowedOptions, Query, _a, GrepQuery; +var init_grep = __esm({ + "src/lib/tasks/grep.ts"() { + init_utils(); + init_task(); + disallowedOptions = ["-h"]; + Query = Symbol("grepQuery"); + GrepQuery = class { + constructor() { + this[_a] = []; + } + *[(_a = Query, Symbol.iterator)]() { + for (const query of this[Query]) { + yield query; + } + } + and(...and) { + and.length && this[Query].push("--and", "(", ...prefixedArray(and, "-e"), ")"); + return this; + } + param(...param) { + this[Query].push(...prefixedArray(param, "-e")); + return this; + } + }; + } +}); + +// src/lib/tasks/reset.ts +var reset_exports = {}; +__export(reset_exports, { + ResetMode: () => ResetMode, + getResetMode: () => getResetMode, + resetTask: () => resetTask +}); +function resetTask(mode, customArgs) { + const commands = ["reset"]; + if (isValidResetMode(mode)) { + commands.push(`--${mode}`); + } + commands.push(...customArgs); + return straightThroughStringTask(commands); +} +function getResetMode(mode) { + if (isValidResetMode(mode)) { + return mode; + } + switch (typeof mode) { + case "string": + case "undefined": + return "soft" /* SOFT */; + } + return; +} +function isValidResetMode(mode) { + return ResetModes.includes(mode); +} +var ResetMode, ResetModes; +var init_reset = __esm({ + "src/lib/tasks/reset.ts"() { + init_task(); + ResetMode = /* @__PURE__ */ ((ResetMode2) => { + ResetMode2["MIXED"] = "mixed"; + ResetMode2["SOFT"] = "soft"; + ResetMode2["HARD"] = "hard"; + ResetMode2["MERGE"] = "merge"; + ResetMode2["KEEP"] = "keep"; + return ResetMode2; + })(ResetMode || {}); + ResetModes = Array.from(Object.values(ResetMode)); + } +}); + +// src/lib/git-logger.ts +import debug from "debug"; +function createLog() { + return debug("simple-git"); +} +function prefixedLogger(to, prefix, forward) { + if (!prefix || !String(prefix).replace(/\s*/, "")) { + return !forward ? to : (message, ...args) => { + to(message, ...args); + forward(message, ...args); + }; + } + return (message, ...args) => { + to(`%s ${message}`, prefix, ...args); + if (forward) { + forward(message, ...args); + } + }; +} +function childLoggerName(name, childDebugger, { namespace: parentNamespace }) { + if (typeof name === "string") { + return name; + } + const childNamespace = childDebugger && childDebugger.namespace || ""; + if (childNamespace.startsWith(parentNamespace)) { + return childNamespace.substr(parentNamespace.length + 1); + } + return childNamespace || parentNamespace; +} +function createLogger(label, verbose, initialStep, infoDebugger = createLog()) { + const labelPrefix = label && `[${label}]` || ""; + const spawned = []; + const debugDebugger = typeof verbose === "string" ? infoDebugger.extend(verbose) : verbose; + const key = childLoggerName(filterType(verbose, filterString), debugDebugger, infoDebugger); + return step(initialStep); + function sibling(name, initial) { + return append(spawned, createLogger(label, key.replace(/^[^:]+/, name), initial, infoDebugger)); + } + function step(phase) { + const stepPrefix = phase && `[${phase}]` || ""; + const debug2 = debugDebugger && prefixedLogger(debugDebugger, stepPrefix) || NOOP; + const info = prefixedLogger(infoDebugger, `${labelPrefix} ${stepPrefix}`, debug2); + return Object.assign(debugDebugger ? debug2 : info, { + label, + sibling, + info, + step + }); + } +} +var init_git_logger = __esm({ + "src/lib/git-logger.ts"() { + init_utils(); + debug.formatters.L = (value) => String(filterHasLength(value) ? value.length : "-"); + debug.formatters.B = (value) => { + if (Buffer.isBuffer(value)) { + return value.toString("utf8"); + } + return objectToString(value); + }; + } +}); + +// src/lib/runners/tasks-pending-queue.ts +var _TasksPendingQueue, TasksPendingQueue; +var init_tasks_pending_queue = __esm({ + "src/lib/runners/tasks-pending-queue.ts"() { + init_git_error(); + init_git_logger(); + _TasksPendingQueue = class { + constructor(logLabel = "GitExecutor") { + this.logLabel = logLabel; + this._queue = /* @__PURE__ */ new Map(); + } + withProgress(task) { + return this._queue.get(task); + } + createProgress(task) { + const name = _TasksPendingQueue.getName(task.commands[0]); + const logger = createLogger(this.logLabel, name); + return { + task, + logger, + name + }; + } + push(task) { + const progress = this.createProgress(task); + progress.logger("Adding task to the queue, commands = %o", task.commands); + this._queue.set(task, progress); + return progress; + } + fatal(err) { + for (const [task, { logger }] of Array.from(this._queue.entries())) { + if (task === err.task) { + logger.info(`Failed %o`, err); + logger(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`); + } else { + logger.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`, err.message); + } + this.complete(task); + } + if (this._queue.size !== 0) { + throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`); + } + } + complete(task) { + const progress = this.withProgress(task); + if (progress) { + this._queue.delete(task); + } + } + attempt(task) { + const progress = this.withProgress(task); + if (!progress) { + throw new GitError(void 0, "TasksPendingQueue: attempt called for an unknown task"); + } + progress.logger("Starting task"); + return progress; + } + static getName(name = "empty") { + return `task:${name}:${++_TasksPendingQueue.counter}`; + } + }; + TasksPendingQueue = _TasksPendingQueue; + TasksPendingQueue.counter = 0; + } +}); + +// src/lib/runners/git-executor-chain.ts +import { spawn } from "child_process"; +function pluginContext(task, commands) { + return { + method: first(task.commands) || "", + commands + }; +} +function onErrorReceived(target, logger) { + return (err) => { + logger(`[ERROR] child process exception %o`, err); + target.push(Buffer.from(String(err.stack), "ascii")); + }; +} +function onDataReceived(target, name, logger, output) { + return (buffer) => { + logger(`%s received %L bytes`, name, buffer); + output(`%B`, buffer); + target.push(buffer); + }; +} +var GitExecutorChain; +var init_git_executor_chain = __esm({ + "src/lib/runners/git-executor-chain.ts"() { + init_git_error(); + init_task(); + init_utils(); + init_tasks_pending_queue(); + GitExecutorChain = class { + constructor(_executor, _scheduler, _plugins) { + this._executor = _executor; + this._scheduler = _scheduler; + this._plugins = _plugins; + this._chain = Promise.resolve(); + this._queue = new TasksPendingQueue(); + } + get binary() { + return this._executor.binary; + } + get cwd() { + return this._cwd || this._executor.cwd; + } + set cwd(cwd) { + this._cwd = cwd; + } + get env() { + return this._executor.env; + } + get outputHandler() { + return this._executor.outputHandler; + } + chain() { + return this; + } + push(task) { + this._queue.push(task); + return this._chain = this._chain.then(() => this.attemptTask(task)); + } + attemptTask(task) { + return __async(this, null, function* () { + const onScheduleComplete = yield this._scheduler.next(); + const onQueueComplete = () => this._queue.complete(task); + try { + const { logger } = this._queue.attempt(task); + return yield isEmptyTask(task) ? this.attemptEmptyTask(task, logger) : this.attemptRemoteTask(task, logger); + } catch (e) { + throw this.onFatalException(task, e); + } finally { + onQueueComplete(); + onScheduleComplete(); + } + }); + } + onFatalException(task, e) { + const gitError = e instanceof GitError ? Object.assign(e, { task }) : new GitError(task, e && String(e)); + this._chain = Promise.resolve(); + this._queue.fatal(gitError); + return gitError; + } + attemptRemoteTask(task, logger) { + return __async(this, null, function* () { + const args = this._plugins.exec("spawn.args", [...task.commands], pluginContext(task, task.commands)); + const raw = yield this.gitResponse(task, this.binary, args, this.outputHandler, logger.step("SPAWN")); + const outputStreams = yield this.handleTaskData(task, args, raw, logger.step("HANDLE")); + logger(`passing response to task's parser as a %s`, task.format); + if (isBufferTask(task)) { + return callTaskParser(task.parser, outputStreams); + } + return callTaskParser(task.parser, outputStreams.asStrings()); + }); + } + attemptEmptyTask(task, logger) { + return __async(this, null, function* () { + logger(`empty task bypassing child process to call to task's parser`); + return task.parser(this); + }); + } + handleTaskData(task, args, result, logger) { + const { exitCode, rejection, stdOut, stdErr } = result; + return new Promise((done, fail) => { + logger(`Preparing to handle process response exitCode=%d stdOut=`, exitCode); + const { error } = this._plugins.exec("task.error", { error: rejection }, __spreadValues(__spreadValues({}, pluginContext(task, args)), result)); + if (error && task.onError) { + logger.info(`exitCode=%s handling with custom error handler`); + return task.onError(result, error, (newStdOut) => { + logger.info(`custom error handler treated as success`); + logger(`custom error returned a %s`, objectToString(newStdOut)); + done(new GitOutputStreams(Array.isArray(newStdOut) ? Buffer.concat(newStdOut) : newStdOut, Buffer.concat(stdErr))); + }, fail); + } + if (error) { + logger.info(`handling as error: exitCode=%s stdErr=%s rejection=%o`, exitCode, stdErr.length, rejection); + return fail(error); + } + logger.info(`retrieving task output complete`); + done(new GitOutputStreams(Buffer.concat(stdOut), Buffer.concat(stdErr))); + }); + } + gitResponse(task, command, args, outputHandler, logger) { + return __async(this, null, function* () { + const outputLogger = logger.sibling("output"); + const spawnOptions = this._plugins.exec("spawn.options", { + cwd: this.cwd, + env: this.env, + windowsHide: true + }, pluginContext(task, task.commands)); + return new Promise((done) => { + const stdOut = []; + const stdErr = []; + let rejection; + logger.info(`%s %o`, command, args); + logger("%O", spawnOptions); + const spawned = spawn(command, args, spawnOptions); + spawned.stdout.on("data", onDataReceived(stdOut, "stdOut", logger, outputLogger.step("stdOut"))); + spawned.stderr.on("data", onDataReceived(stdErr, "stdErr", logger, outputLogger.step("stdErr"))); + spawned.on("error", onErrorReceived(stdErr, logger)); + if (outputHandler) { + logger(`Passing child process stdOut/stdErr to custom outputHandler`); + outputHandler(command, spawned.stdout, spawned.stderr, [...args]); + } + this._plugins.exec("spawn.after", void 0, __spreadProps(__spreadValues({}, pluginContext(task, args)), { + spawned, + close(exitCode, reason) { + done({ + stdOut, + stdErr, + exitCode, + rejection: rejection || reason + }); + }, + kill(reason) { + if (spawned.killed) { + return; + } + rejection = reason; + spawned.kill("SIGINT"); + } + })); + }); + }); + } + }; + } +}); + +// src/lib/runners/git-executor.ts +var git_executor_exports = {}; +__export(git_executor_exports, { + GitExecutor: () => GitExecutor +}); +var GitExecutor; +var init_git_executor = __esm({ + "src/lib/runners/git-executor.ts"() { + init_git_executor_chain(); + GitExecutor = class { + constructor(binary = "git", cwd, _scheduler, _plugins) { + this.binary = binary; + this.cwd = cwd; + this._scheduler = _scheduler; + this._plugins = _plugins; + this._chain = new GitExecutorChain(this, this._scheduler, this._plugins); + } + chain() { + return new GitExecutorChain(this, this._scheduler, this._plugins); + } + push(task) { + return this._chain.push(task); + } + }; + } +}); + +// src/lib/task-callback.ts +function taskCallback(task, response, callback = NOOP) { + const onSuccess = (data) => { + callback(null, data); + }; + const onError2 = (err) => { + if ((err == null ? void 0 : err.task) === task) { + callback(err instanceof GitResponseError ? addDeprecationNoticeToError(err) : err, void 0); + } + }; + response.then(onSuccess, onError2); +} +function addDeprecationNoticeToError(err) { + let log = (name) => { + console.warn(`simple-git deprecation notice: accessing GitResponseError.${name} should be GitResponseError.git.${name}, this will no longer be available in version 3`); + log = NOOP; + }; + return Object.create(err, Object.getOwnPropertyNames(err.git).reduce(descriptorReducer, {})); + function descriptorReducer(all, name) { + if (name in err) { + return all; + } + all[name] = { + enumerable: false, + configurable: false, + get() { + log(name); + return err.git[name]; + } + }; + return all; + } +} +var init_task_callback = __esm({ + "src/lib/task-callback.ts"() { + init_git_response_error(); + init_utils(); + } +}); + +// src/lib/tasks/change-working-directory.ts +function changeWorkingDirectoryTask(directory, root) { + return adhocExecTask((instance) => { + if (!folderExists(directory)) { + throw new Error(`Git.cwd: cannot change to non-directory "${directory}"`); + } + return (root || instance).cwd = directory; + }); +} +var init_change_working_directory = __esm({ + "src/lib/tasks/change-working-directory.ts"() { + init_utils(); + init_task(); + } +}); + +// src/lib/tasks/hash-object.ts +function hashObjectTask(filePath, write) { + const commands = ["hash-object", filePath]; + if (write) { + commands.push("-w"); + } + return straightThroughStringTask(commands, true); +} +var init_hash_object = __esm({ + "src/lib/tasks/hash-object.ts"() { + init_task(); + } +}); + +// src/lib/responses/InitSummary.ts +function parseInit(bare, path, text) { + const response = String(text).trim(); + let result; + if (result = initResponseRegex.exec(response)) { + return new InitSummary(bare, path, false, result[1]); + } + if (result = reInitResponseRegex.exec(response)) { + return new InitSummary(bare, path, true, result[1]); + } + let gitDir = ""; + const tokens = response.split(" "); + while (tokens.length) { + const token = tokens.shift(); + if (token === "in") { + gitDir = tokens.join(" "); + break; + } + } + return new InitSummary(bare, path, /^re/i.test(response), gitDir); +} +var InitSummary, initResponseRegex, reInitResponseRegex; +var init_InitSummary = __esm({ + "src/lib/responses/InitSummary.ts"() { + InitSummary = class { + constructor(bare, path, existing, gitDir) { + this.bare = bare; + this.path = path; + this.existing = existing; + this.gitDir = gitDir; + } + }; + initResponseRegex = /^Init.+ repository in (.+)$/; + reInitResponseRegex = /^Rein.+ in (.+)$/; + } +}); + +// src/lib/tasks/init.ts +function hasBareCommand(command) { + return command.includes(bareCommand); +} +function initTask(bare = false, path, customArgs) { + const commands = ["init", ...customArgs]; + if (bare && !hasBareCommand(commands)) { + commands.splice(1, 0, bareCommand); + } + return { + commands, + format: "utf-8", + parser(text) { + return parseInit(commands.includes("--bare"), path, text); + } + }; +} +var bareCommand; +var init_init = __esm({ + "src/lib/tasks/init.ts"() { + init_InitSummary(); + bareCommand = "--bare"; + } +}); + +// src/lib/responses/DiffSummary.ts +var DiffSummary; +var init_DiffSummary = __esm({ + "src/lib/responses/DiffSummary.ts"() { + DiffSummary = class { + constructor() { + this.changed = 0; + this.deletions = 0; + this.insertions = 0; + this.files = []; + } + }; + } +}); + +// src/lib/parsers/parse-diff-summary.ts +function parseDiffResult(stdOut) { + const lines = stdOut.trim().split("\n"); + const status = new DiffSummary(); + readSummaryLine(status, lines.pop()); + for (let i = 0, max = lines.length; i < max; i++) { + const line = lines[i]; + textFileChange(line, status) || binaryFileChange(line, status); + } + return status; +} +function readSummaryLine(status, summary) { + (summary || "").trim().split(", ").forEach(function(text) { + const summary2 = /(\d+)\s([a-z]+)/.exec(text); + if (!summary2) { + return; + } + summaryType(status, summary2[2], parseInt(summary2[1], 10)); + }); +} +function summaryType(status, key, value) { + const match = /([a-z]+?)s?\b/.exec(key); + if (!match || !statusUpdate[match[1]]) { + return; + } + statusUpdate[match[1]](status, value); +} +function textFileChange(input, { files }) { + const line = input.trim().match(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/); + if (line) { + var alterations = (line[3] || "").trim(); + files.push({ + file: line[1].trim(), + changes: parseInt(line[2], 10), + insertions: alterations.replace(/-/g, "").length, + deletions: alterations.replace(/\+/g, "").length, + binary: false + }); + return true; + } + return false; +} +function binaryFileChange(input, { files }) { + const line = input.match(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)$/); + if (line) { + files.push({ + file: line[1].trim(), + before: +line[2], + after: +line[3], + binary: true + }); + return true; + } + return false; +} +var statusUpdate; +var init_parse_diff_summary = __esm({ + "src/lib/parsers/parse-diff-summary.ts"() { + init_DiffSummary(); + statusUpdate = { + file(status, value) { + status.changed = value; + }, + deletion(status, value) { + status.deletions = value; + }, + insertion(status, value) { + status.insertions = value; + } + }; + } +}); + +// src/lib/parsers/parse-list-log-summary.ts +function lineBuilder(tokens, fields) { + return fields.reduce((line, field, index) => { + line[field] = tokens[index] || ""; + return line; + }, /* @__PURE__ */ Object.create({ diff: null })); +} +function createListLogSummaryParser(splitter = SPLITTER, fields = defaultFieldNames) { + return function(stdOut) { + const all = toLinesWithContent(stdOut, true, START_BOUNDARY).map(function(item) { + const lineDetail = item.trim().split(COMMIT_BOUNDARY); + const listLogLine = lineBuilder(lineDetail[0].trim().split(splitter), fields); + if (lineDetail.length > 1 && !!lineDetail[1].trim()) { + listLogLine.diff = parseDiffResult(lineDetail[1]); + } + return listLogLine; + }); + return { + all, + latest: all.length && all[0] || null, + total: all.length + }; + }; +} +var START_BOUNDARY, COMMIT_BOUNDARY, SPLITTER, defaultFieldNames; +var init_parse_list_log_summary = __esm({ + "src/lib/parsers/parse-list-log-summary.ts"() { + init_utils(); + init_parse_diff_summary(); + START_BOUNDARY = "\xF2\xF2\xF2\xF2\xF2\xF2 "; + COMMIT_BOUNDARY = " \xF2\xF2"; + SPLITTER = " \xF2 "; + defaultFieldNames = ["hash", "date", "message", "refs", "author_name", "author_email"]; + } +}); + +// src/lib/tasks/log.ts +function prettyFormat(format, splitter) { + const fields = []; + const formatStr = []; + Object.keys(format).forEach((field) => { + fields.push(field); + formatStr.push(String(format[field])); + }); + return [ + fields, + formatStr.join(splitter) + ]; +} +function userOptions(input) { + const output = __spreadValues({}, input); + Object.keys(input).forEach((key) => { + if (key in excludeOptions) { + delete output[key]; + } + }); + return output; +} +function parseLogOptions(opt = {}, customArgs = []) { + const splitter = opt.splitter || SPLITTER; + const format = opt.format || { + hash: "%H", + date: opt.strictDate === false ? "%ai" : "%aI", + message: "%s", + refs: "%D", + body: opt.multiLine ? "%B" : "%b", + author_name: opt.mailMap !== false ? "%aN" : "%an", + author_email: opt.mailMap !== false ? "%aE" : "%ae" + }; + const [fields, formatStr] = prettyFormat(format, splitter); + const suffix = []; + const command = [ + `--pretty=format:${START_BOUNDARY}${formatStr}${COMMIT_BOUNDARY}`, + ...customArgs + ]; + const maxCount = opt.n || opt["max-count"] || opt.maxCount; + if (maxCount) { + command.push(`--max-count=${maxCount}`); + } + if (opt.from && opt.to) { + const rangeOperator = opt.symmetric !== false ? "..." : ".."; + suffix.push(`${opt.from}${rangeOperator}${opt.to}`); + } + if (opt.file) { + suffix.push("--follow", opt.file); + } + appendTaskOptions(userOptions(opt), command); + return { + fields, + splitter, + commands: [ + ...command, + ...suffix + ] + }; +} +function logTask(splitter, fields, customArgs) { + return { + commands: ["log", ...customArgs], + format: "utf-8", + parser: createListLogSummaryParser(splitter, fields) + }; +} +function log_default() { + return { + log(...rest) { + const next = trailingFunctionArgument(arguments); + const task = rejectDeprecatedSignatures(...rest) || createLogTask(parseLogOptions(trailingOptionsArgument(arguments), filterType(arguments[0], filterArray))); + return this._runTask(task, next); + } + }; + function createLogTask(options) { + return logTask(options.splitter, options.fields, options.commands); + } + function rejectDeprecatedSignatures(from, to) { + return filterString(from) && filterString(to) && configurationErrorTask(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`); + } +} +var excludeOptions; +var init_log = __esm({ + "src/lib/tasks/log.ts"() { + init_parse_list_log_summary(); + init_utils(); + init_task(); + excludeOptions = /* @__PURE__ */ ((excludeOptions2) => { + excludeOptions2[excludeOptions2["--pretty"] = 0] = "--pretty"; + excludeOptions2[excludeOptions2["max-count"] = 1] = "max-count"; + excludeOptions2[excludeOptions2["maxCount"] = 2] = "maxCount"; + excludeOptions2[excludeOptions2["n"] = 3] = "n"; + excludeOptions2[excludeOptions2["file"] = 4] = "file"; + excludeOptions2[excludeOptions2["format"] = 5] = "format"; + excludeOptions2[excludeOptions2["from"] = 6] = "from"; + excludeOptions2[excludeOptions2["to"] = 7] = "to"; + excludeOptions2[excludeOptions2["splitter"] = 8] = "splitter"; + excludeOptions2[excludeOptions2["symmetric"] = 9] = "symmetric"; + excludeOptions2[excludeOptions2["mailMap"] = 10] = "mailMap"; + excludeOptions2[excludeOptions2["multiLine"] = 11] = "multiLine"; + excludeOptions2[excludeOptions2["strictDate"] = 12] = "strictDate"; + return excludeOptions2; + })(excludeOptions || {}); + } +}); + +// src/lib/responses/MergeSummary.ts +var MergeSummaryConflict, MergeSummaryDetail; +var init_MergeSummary = __esm({ + "src/lib/responses/MergeSummary.ts"() { + MergeSummaryConflict = class { + constructor(reason, file = null, meta) { + this.reason = reason; + this.file = file; + this.meta = meta; + } + toString() { + return `${this.file}:${this.reason}`; + } + }; + MergeSummaryDetail = class { + constructor() { + this.conflicts = []; + this.merges = []; + this.result = "success"; + } + get failed() { + return this.conflicts.length > 0; + } + get reason() { + return this.result; + } + toString() { + if (this.conflicts.length) { + return `CONFLICTS: ${this.conflicts.join(", ")}`; + } + return "OK"; + } + }; + } +}); + +// src/lib/responses/PullSummary.ts +var PullSummary, PullFailedSummary; +var init_PullSummary = __esm({ + "src/lib/responses/PullSummary.ts"() { + PullSummary = class { + constructor() { + this.remoteMessages = { + all: [] + }; + this.created = []; + this.deleted = []; + this.files = []; + this.deletions = {}; + this.insertions = {}; + this.summary = { + changes: 0, + deletions: 0, + insertions: 0 + }; + } + }; + PullFailedSummary = class { + constructor() { + this.remote = ""; + this.hash = { + local: "", + remote: "" + }; + this.branch = { + local: "", + remote: "" + }; + this.message = ""; + } + toString() { + return this.message; + } + }; + } +}); + +// src/lib/parsers/parse-remote-objects.ts +function objectEnumerationResult(remoteMessages) { + return remoteMessages.objects = remoteMessages.objects || { + compressing: 0, + counting: 0, + enumerating: 0, + packReused: 0, + reused: { count: 0, delta: 0 }, + total: { count: 0, delta: 0 } + }; +} +function asObjectCount(source) { + const count = /^\s*(\d+)/.exec(source); + const delta = /delta (\d+)/i.exec(source); + return { + count: asNumber(count && count[1] || "0"), + delta: asNumber(delta && delta[1] || "0") + }; +} +var remoteMessagesObjectParsers; +var init_parse_remote_objects = __esm({ + "src/lib/parsers/parse-remote-objects.ts"() { + init_utils(); + remoteMessagesObjectParsers = [ + new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i, (result, [action, count]) => { + const key = action.toLowerCase(); + const enumeration = objectEnumerationResult(result.remoteMessages); + Object.assign(enumeration, { [key]: asNumber(count) }); + }), + new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i, (result, [action, count]) => { + const key = action.toLowerCase(); + const enumeration = objectEnumerationResult(result.remoteMessages); + Object.assign(enumeration, { [key]: asNumber(count) }); + }), + new RemoteLineParser(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i, (result, [total, reused, packReused]) => { + const objects = objectEnumerationResult(result.remoteMessages); + objects.total = asObjectCount(total); + objects.reused = asObjectCount(reused); + objects.packReused = asNumber(packReused); + }) + ]; + } +}); + +// src/lib/parsers/parse-remote-messages.ts +function parseRemoteMessages(_stdOut, stdErr) { + return parseStringResponse({ remoteMessages: new RemoteMessageSummary() }, parsers, stdErr); +} +var parsers, RemoteMessageSummary; +var init_parse_remote_messages = __esm({ + "src/lib/parsers/parse-remote-messages.ts"() { + init_utils(); + init_parse_remote_objects(); + parsers = [ + new RemoteLineParser(/^remote:\s*(.+)$/, (result, [text]) => { + result.remoteMessages.all.push(text.trim()); + return false; + }), + ...remoteMessagesObjectParsers, + new RemoteLineParser([/create a (?:pull|merge) request/i, /\s(https?:\/\/\S+)$/], (result, [pullRequestUrl]) => { + result.remoteMessages.pullRequestUrl = pullRequestUrl; + }), + new RemoteLineParser([/found (\d+) vulnerabilities.+\(([^)]+)\)/i, /\s(https?:\/\/\S+)$/], (result, [count, summary, url]) => { + result.remoteMessages.vulnerabilities = { + count: asNumber(count), + summary, + url + }; + }) + ]; + RemoteMessageSummary = class { + constructor() { + this.all = []; + } + }; + } +}); + +// src/lib/parsers/parse-pull.ts +function parsePullErrorResult(stdOut, stdErr) { + const pullError = parseStringResponse(new PullFailedSummary(), errorParsers, stdOut, stdErr); + return pullError.message && pullError; +} +var FILE_UPDATE_REGEX, SUMMARY_REGEX, ACTION_REGEX, parsers2, errorParsers, parsePullDetail, parsePullResult; +var init_parse_pull = __esm({ + "src/lib/parsers/parse-pull.ts"() { + init_PullSummary(); + init_utils(); + init_parse_remote_messages(); + FILE_UPDATE_REGEX = /^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/; + SUMMARY_REGEX = /(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/; + ACTION_REGEX = /^(create|delete) mode \d+ (.+)/; + parsers2 = [ + new LineParser(FILE_UPDATE_REGEX, (result, [file, insertions, deletions]) => { + result.files.push(file); + if (insertions) { + result.insertions[file] = insertions.length; + } + if (deletions) { + result.deletions[file] = deletions.length; + } + }), + new LineParser(SUMMARY_REGEX, (result, [changes, , insertions, , deletions]) => { + if (insertions !== void 0 || deletions !== void 0) { + result.summary.changes = +changes || 0; + result.summary.insertions = +insertions || 0; + result.summary.deletions = +deletions || 0; + return true; + } + return false; + }), + new LineParser(ACTION_REGEX, (result, [action, file]) => { + append(result.files, file); + append(action === "create" ? result.created : result.deleted, file); + }) + ]; + errorParsers = [ + new LineParser(/^from\s(.+)$/i, (result, [remote]) => void (result.remote = remote)), + new LineParser(/^fatal:\s(.+)$/, (result, [message]) => void (result.message = message)), + new LineParser(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/, (result, [hashLocal, hashRemote, branchLocal, branchRemote]) => { + result.branch.local = branchLocal; + result.hash.local = hashLocal; + result.branch.remote = branchRemote; + result.hash.remote = hashRemote; + }) + ]; + parsePullDetail = (stdOut, stdErr) => { + return parseStringResponse(new PullSummary(), parsers2, stdOut, stdErr); + }; + parsePullResult = (stdOut, stdErr) => { + return Object.assign(new PullSummary(), parsePullDetail(stdOut, stdErr), parseRemoteMessages(stdOut, stdErr)); + }; + } +}); + +// src/lib/parsers/parse-merge.ts +var parsers3, parseMergeResult, parseMergeDetail; +var init_parse_merge = __esm({ + "src/lib/parsers/parse-merge.ts"() { + init_MergeSummary(); + init_utils(); + init_parse_pull(); + parsers3 = [ + new LineParser(/^Auto-merging\s+(.+)$/, (summary, [autoMerge]) => { + summary.merges.push(autoMerge); + }), + new LineParser(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/, (summary, [reason, file]) => { + summary.conflicts.push(new MergeSummaryConflict(reason, file)); + }), + new LineParser(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/, (summary, [reason, file, deleteRef]) => { + summary.conflicts.push(new MergeSummaryConflict(reason, file, { deleteRef })); + }), + new LineParser(/^CONFLICT\s+\((.+)\):/, (summary, [reason]) => { + summary.conflicts.push(new MergeSummaryConflict(reason, null)); + }), + new LineParser(/^Automatic merge failed;\s+(.+)$/, (summary, [result]) => { + summary.result = result; + }) + ]; + parseMergeResult = (stdOut, stdErr) => { + return Object.assign(parseMergeDetail(stdOut, stdErr), parsePullResult(stdOut, stdErr)); + }; + parseMergeDetail = (stdOut) => { + return parseStringResponse(new MergeSummaryDetail(), parsers3, stdOut); + }; + } +}); + +// src/lib/tasks/merge.ts +function mergeTask(customArgs) { + if (!customArgs.length) { + return configurationErrorTask("Git.merge requires at least one option"); + } + return { + commands: ["merge", ...customArgs], + format: "utf-8", + parser(stdOut, stdErr) { + const merge = parseMergeResult(stdOut, stdErr); + if (merge.failed) { + throw new GitResponseError(merge); + } + return merge; + } + }; +} +var init_merge = __esm({ + "src/lib/tasks/merge.ts"() { + init_git_response_error(); + init_parse_merge(); + init_task(); + } +}); + +// src/lib/parsers/parse-push.ts +function pushResultPushedItem(local, remote, status) { + const deleted = status.includes("deleted"); + const tag = status.includes("tag") || /^refs\/tags/.test(local); + const alreadyUpdated = !status.includes("new"); + return { + deleted, + tag, + branch: !tag, + new: !alreadyUpdated, + alreadyUpdated, + local, + remote + }; +} +var parsers4, parsePushResult, parsePushDetail; +var init_parse_push = __esm({ + "src/lib/parsers/parse-push.ts"() { + init_utils(); + init_parse_remote_messages(); + parsers4 = [ + new LineParser(/^Pushing to (.+)$/, (result, [repo]) => { + result.repo = repo; + }), + new LineParser(/^updating local tracking ref '(.+)'/, (result, [local]) => { + result.ref = __spreadProps(__spreadValues({}, result.ref || {}), { + local + }); + }), + new LineParser(/^[*-=]\s+([^:]+):(\S+)\s+\[(.+)]$/, (result, [local, remote, type]) => { + result.pushed.push(pushResultPushedItem(local, remote, type)); + }), + new LineParser(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/, (result, [local, remote, remoteName]) => { + result.branch = __spreadProps(__spreadValues({}, result.branch || {}), { + local, + remote, + remoteName + }); + }), + new LineParser(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/, (result, [local, remote, from, to]) => { + result.update = { + head: { + local, + remote + }, + hash: { + from, + to + } + }; + }) + ]; + parsePushResult = (stdOut, stdErr) => { + const pushDetail = parsePushDetail(stdOut, stdErr); + const responseDetail = parseRemoteMessages(stdOut, stdErr); + return __spreadValues(__spreadValues({}, pushDetail), responseDetail); + }; + parsePushDetail = (stdOut, stdErr) => { + return parseStringResponse({ pushed: [] }, parsers4, stdOut, stdErr); + }; + } +}); + +// src/lib/tasks/push.ts +var push_exports = {}; +__export(push_exports, { + pushTagsTask: () => pushTagsTask, + pushTask: () => pushTask +}); +function pushTagsTask(ref = {}, customArgs) { + append(customArgs, "--tags"); + return pushTask(ref, customArgs); +} +function pushTask(ref = {}, customArgs) { + const commands = ["push", ...customArgs]; + if (ref.branch) { + commands.splice(1, 0, ref.branch); + } + if (ref.remote) { + commands.splice(1, 0, ref.remote); + } + remove(commands, "-v"); + append(commands, "--verbose"); + append(commands, "--porcelain"); + return { + commands, + format: "utf-8", + parser: parsePushResult + }; +} +var init_push = __esm({ + "src/lib/tasks/push.ts"() { + init_parse_push(); + init_utils(); + } +}); + +// src/lib/responses/FileStatusSummary.ts +var fromPathRegex, FileStatusSummary; +var init_FileStatusSummary = __esm({ + "src/lib/responses/FileStatusSummary.ts"() { + fromPathRegex = /^(.+) -> (.+)$/; + FileStatusSummary = class { + constructor(path, index, working_dir) { + this.path = path; + this.index = index; + this.working_dir = working_dir; + if (index + working_dir === "R") { + const detail = fromPathRegex.exec(path) || [null, path, path]; + this.from = detail[1] || ""; + this.path = detail[2] || ""; + } + } + }; + } +}); + +// src/lib/responses/StatusSummary.ts +function renamedFile(line) { + const detail = /^(.+) -> (.+)$/.exec(line); + if (!detail) { + return { + from: line, + to: line + }; + } + return { + from: String(detail[1]), + to: String(detail[2]) + }; +} +function parser2(indexX, indexY, handler) { + return [`${indexX}${indexY}`, handler]; +} +function conflicts(indexX, ...indexY) { + return indexY.map((y) => parser2(indexX, y, (result, file) => append(result.conflicted, file))); +} +function splitLine(result, lineStr) { + const trimmed2 = lineStr.trim(); + switch (" ") { + case trimmed2.charAt(2): + return data(trimmed2.charAt(0), trimmed2.charAt(1), trimmed2.substr(3)); + case trimmed2.charAt(1): + return data(" " /* NONE */, trimmed2.charAt(0), trimmed2.substr(2)); + default: + return; + } + function data(index, workingDir, path) { + const raw = `${index}${workingDir}`; + const handler = parsers5.get(raw); + if (handler) { + handler(result, path); + } + if (raw !== "##" && raw !== "!!") { + result.files.push(new FileStatusSummary(path, index, workingDir)); + } + } +} +var StatusSummary, parsers5, parseStatusSummary; +var init_StatusSummary = __esm({ + "src/lib/responses/StatusSummary.ts"() { + init_utils(); + init_FileStatusSummary(); + StatusSummary = class { + constructor() { + this.not_added = []; + this.conflicted = []; + this.created = []; + this.deleted = []; + this.ignored = void 0; + this.modified = []; + this.renamed = []; + this.files = []; + this.staged = []; + this.ahead = 0; + this.behind = 0; + this.current = null; + this.tracking = null; + this.detached = false; + } + isClean() { + return !this.files.length; + } + }; + parsers5 = new Map([ + parser2(" " /* NONE */, "A" /* ADDED */, (result, file) => append(result.created, file)), + parser2(" " /* NONE */, "D" /* DELETED */, (result, file) => append(result.deleted, file)), + parser2(" " /* NONE */, "M" /* MODIFIED */, (result, file) => append(result.modified, file)), + parser2("A" /* ADDED */, " " /* NONE */, (result, file) => append(result.created, file) && append(result.staged, file)), + parser2("A" /* ADDED */, "M" /* MODIFIED */, (result, file) => append(result.created, file) && append(result.staged, file) && append(result.modified, file)), + parser2("D" /* DELETED */, " " /* NONE */, (result, file) => append(result.deleted, file) && append(result.staged, file)), + parser2("M" /* MODIFIED */, " " /* NONE */, (result, file) => append(result.modified, file) && append(result.staged, file)), + parser2("M" /* MODIFIED */, "M" /* MODIFIED */, (result, file) => append(result.modified, file) && append(result.staged, file)), + parser2("R" /* RENAMED */, " " /* NONE */, (result, file) => { + append(result.renamed, renamedFile(file)); + }), + parser2("R" /* RENAMED */, "M" /* MODIFIED */, (result, file) => { + const renamed = renamedFile(file); + append(result.renamed, renamed); + append(result.modified, renamed.to); + }), + parser2("!" /* IGNORED */, "!" /* IGNORED */, (_result, _file) => { + append(_result.ignored = _result.ignored || [], _file); + }), + parser2("?" /* UNTRACKED */, "?" /* UNTRACKED */, (result, file) => append(result.not_added, file)), + ...conflicts("A" /* ADDED */, "A" /* ADDED */, "U" /* UNMERGED */), + ...conflicts("D" /* DELETED */, "D" /* DELETED */, "U" /* UNMERGED */), + ...conflicts("U" /* UNMERGED */, "A" /* ADDED */, "D" /* DELETED */, "U" /* UNMERGED */), + ["##", (result, line) => { + const aheadReg = /ahead (\d+)/; + const behindReg = /behind (\d+)/; + const currentReg = /^(.+?(?=(?:\.{3}|\s|$)))/; + const trackingReg = /\.{3}(\S*)/; + const onEmptyBranchReg = /\son\s([\S]+)$/; + let regexResult; + regexResult = aheadReg.exec(line); + result.ahead = regexResult && +regexResult[1] || 0; + regexResult = behindReg.exec(line); + result.behind = regexResult && +regexResult[1] || 0; + regexResult = currentReg.exec(line); + result.current = regexResult && regexResult[1]; + regexResult = trackingReg.exec(line); + result.tracking = regexResult && regexResult[1]; + regexResult = onEmptyBranchReg.exec(line); + result.current = regexResult && regexResult[1] || result.current; + result.detached = /\(no branch\)/.test(line); + }] + ]); + parseStatusSummary = function(text) { + const lines = text.trim().split("\n"); + const status = new StatusSummary(); + for (let i = 0, l = lines.length; i < l; i++) { + splitLine(status, lines[i]); + } + return status; + }; + } +}); + +// src/lib/tasks/status.ts +function statusTask(customArgs) { + return { + format: "utf-8", + commands: ["status", "--porcelain", "-b", "-u", ...customArgs], + parser(text) { + return parseStatusSummary(text); + } + }; +} +var init_status = __esm({ + "src/lib/tasks/status.ts"() { + init_StatusSummary(); + } +}); + +// src/lib/simple-git-api.ts +var simple_git_api_exports = {}; +__export(simple_git_api_exports, { + SimpleGitApi: () => SimpleGitApi +}); +var SimpleGitApi; +var init_simple_git_api = __esm({ + "src/lib/simple-git-api.ts"() { + init_task_callback(); + init_change_working_directory(); + init_config(); + init_grep(); + init_hash_object(); + init_init(); + init_log(); + init_merge(); + init_push(); + init_status(); + init_task(); + init_utils(); + SimpleGitApi = class { + constructor(_executor) { + this._executor = _executor; + } + _runTask(task, then) { + const chain = this._executor.chain(); + const promise = chain.push(task); + if (then) { + taskCallback(task, promise, then); + } + return Object.create(this, { + then: { value: promise.then.bind(promise) }, + catch: { value: promise.catch.bind(promise) }, + _executor: { value: chain } + }); + } + add(files) { + return this._runTask(straightThroughStringTask(["add", ...asArray(files)]), trailingFunctionArgument(arguments)); + } + cwd(directory) { + const next = trailingFunctionArgument(arguments); + if (typeof directory === "string") { + return this._runTask(changeWorkingDirectoryTask(directory, this._executor), next); + } + if (typeof (directory == null ? void 0 : directory.path) === "string") { + return this._runTask(changeWorkingDirectoryTask(directory.path, directory.root && this._executor || void 0), next); + } + return this._runTask(configurationErrorTask("Git.cwd: workingDirectory must be supplied as a string"), next); + } + hashObject(path, write) { + return this._runTask(hashObjectTask(path, write === true), trailingFunctionArgument(arguments)); + } + init(bare) { + return this._runTask(initTask(bare === true, this._executor.cwd, getTrailingOptions(arguments)), trailingFunctionArgument(arguments)); + } + merge() { + return this._runTask(mergeTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments)); + } + mergeFromTo(remote, branch) { + if (!(filterString(remote) && filterString(branch))) { + return this._runTask(configurationErrorTask(`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`)); + } + return this._runTask(mergeTask([remote, branch, ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments, false)); + } + outputHandler(handler) { + this._executor.outputHandler = handler; + return this; + } + push() { + const task = pushTask({ + remote: filterType(arguments[0], filterString), + branch: filterType(arguments[1], filterString) + }, getTrailingOptions(arguments)); + return this._runTask(task, trailingFunctionArgument(arguments)); + } + stash() { + return this._runTask(straightThroughStringTask(["stash", ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments)); + } + status() { + return this._runTask(statusTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments)); + } + }; + Object.assign(SimpleGitApi.prototype, config_default(), grep_default(), log_default()); + } +}); + +// src/lib/runners/scheduler.ts +var scheduler_exports = {}; +__export(scheduler_exports, { + Scheduler: () => Scheduler +}); +import { createDeferred } from "@kwsites/promise-deferred"; +var createScheduledTask, Scheduler; +var init_scheduler = __esm({ + "src/lib/runners/scheduler.ts"() { + init_utils(); + init_git_logger(); + createScheduledTask = (() => { + let id = 0; + return () => { + id++; + const { promise, done } = createDeferred(); + return { + promise, + done, + id + }; + }; + })(); + Scheduler = class { + constructor(concurrency = 2) { + this.concurrency = concurrency; + this.logger = createLogger("", "scheduler"); + this.pending = []; + this.running = []; + this.logger(`Constructed, concurrency=%s`, concurrency); + } + schedule() { + if (!this.pending.length || this.running.length >= this.concurrency) { + this.logger(`Schedule attempt ignored, pending=%s running=%s concurrency=%s`, this.pending.length, this.running.length, this.concurrency); + return; + } + const task = append(this.running, this.pending.shift()); + this.logger(`Attempting id=%s`, task.id); + task.done(() => { + this.logger(`Completing id=`, task.id); + remove(this.running, task); + this.schedule(); + }); + } + next() { + const { promise, id } = append(this.pending, createScheduledTask()); + this.logger(`Scheduling id=%s`, id); + this.schedule(); + return promise; + } + }; + } +}); + +// src/lib/tasks/apply-patch.ts +var apply_patch_exports = {}; +__export(apply_patch_exports, { + applyPatchTask: () => applyPatchTask +}); +function applyPatchTask(patches, customArgs) { + return straightThroughStringTask(["apply", ...customArgs, ...patches]); +} +var init_apply_patch = __esm({ + "src/lib/tasks/apply-patch.ts"() { + init_task(); + } +}); + +// src/lib/responses/BranchDeleteSummary.ts +function branchDeletionSuccess(branch, hash) { + return { + branch, + hash, + success: true + }; +} +function branchDeletionFailure(branch) { + return { + branch, + hash: null, + success: false + }; +} +var BranchDeletionBatch; +var init_BranchDeleteSummary = __esm({ + "src/lib/responses/BranchDeleteSummary.ts"() { + BranchDeletionBatch = class { + constructor() { + this.all = []; + this.branches = {}; + this.errors = []; + } + get success() { + return !this.errors.length; + } + }; + } +}); + +// src/lib/parsers/parse-branch-delete.ts +function hasBranchDeletionError(data, processExitCode) { + return processExitCode === 1 /* ERROR */ && deleteErrorRegex.test(data); +} +var deleteSuccessRegex, deleteErrorRegex, parsers6, parseBranchDeletions; +var init_parse_branch_delete = __esm({ + "src/lib/parsers/parse-branch-delete.ts"() { + init_BranchDeleteSummary(); + init_utils(); + deleteSuccessRegex = /(\S+)\s+\(\S+\s([^)]+)\)/; + deleteErrorRegex = /^error[^']+'([^']+)'/m; + parsers6 = [ + new LineParser(deleteSuccessRegex, (result, [branch, hash]) => { + const deletion = branchDeletionSuccess(branch, hash); + result.all.push(deletion); + result.branches[branch] = deletion; + }), + new LineParser(deleteErrorRegex, (result, [branch]) => { + const deletion = branchDeletionFailure(branch); + result.errors.push(deletion); + result.all.push(deletion); + result.branches[branch] = deletion; + }) + ]; + parseBranchDeletions = (stdOut, stdErr) => { + return parseStringResponse(new BranchDeletionBatch(), parsers6, stdOut, stdErr); + }; + } +}); + +// src/lib/responses/BranchSummary.ts +var BranchSummaryResult; +var init_BranchSummary = __esm({ + "src/lib/responses/BranchSummary.ts"() { + BranchSummaryResult = class { + constructor() { + this.all = []; + this.branches = {}; + this.current = ""; + this.detached = false; + } + push(current, detached, name, commit, label) { + if (current) { + this.detached = detached; + this.current = name; + } + this.all.push(name); + this.branches[name] = { + current, + name, + commit, + label + }; + } + }; + } +}); + +// src/lib/parsers/parse-branch.ts +function parseBranchSummary(stdOut) { + return parseStringResponse(new BranchSummaryResult(), parsers7, stdOut); +} +var parsers7; +var init_parse_branch = __esm({ + "src/lib/parsers/parse-branch.ts"() { + init_BranchSummary(); + init_utils(); + parsers7 = [ + new LineParser(/^(\*\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/, (result, [current, name, commit, label]) => { + result.push(!!current, true, name, commit, label); + }), + new LineParser(/^(\*\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s, (result, [current, name, commit, label]) => { + result.push(!!current, false, name, commit, label); + }) + ]; + } +}); + +// src/lib/tasks/branch.ts +var branch_exports = {}; +__export(branch_exports, { + branchLocalTask: () => branchLocalTask, + branchTask: () => branchTask, + containsDeleteBranchCommand: () => containsDeleteBranchCommand, + deleteBranchTask: () => deleteBranchTask, + deleteBranchesTask: () => deleteBranchesTask +}); +function containsDeleteBranchCommand(commands) { + const deleteCommands = ["-d", "-D", "--delete"]; + return commands.some((command) => deleteCommands.includes(command)); +} +function branchTask(customArgs) { + const isDelete = containsDeleteBranchCommand(customArgs); + const commands = ["branch", ...customArgs]; + if (commands.length === 1) { + commands.push("-a"); + } + if (!commands.includes("-v")) { + commands.splice(1, 0, "-v"); + } + return { + format: "utf-8", + commands, + parser(stdOut, stdErr) { + if (isDelete) { + return parseBranchDeletions(stdOut, stdErr).all[0]; + } + return parseBranchSummary(stdOut); + } + }; +} +function branchLocalTask() { + const parser3 = parseBranchSummary; + return { + format: "utf-8", + commands: ["branch", "-v"], + parser: parser3 + }; +} +function deleteBranchesTask(branches, forceDelete = false) { + return { + format: "utf-8", + commands: ["branch", "-v", forceDelete ? "-D" : "-d", ...branches], + parser(stdOut, stdErr) { + return parseBranchDeletions(stdOut, stdErr); + }, + onError({ exitCode, stdOut }, error, done, fail) { + if (!hasBranchDeletionError(String(error), exitCode)) { + return fail(error); + } + done(stdOut); + } + }; +} +function deleteBranchTask(branch, forceDelete = false) { + const task = { + format: "utf-8", + commands: ["branch", "-v", forceDelete ? "-D" : "-d", branch], + parser(stdOut, stdErr) { + return parseBranchDeletions(stdOut, stdErr).branches[branch]; + }, + onError({ exitCode, stdErr, stdOut }, error, _, fail) { + if (!hasBranchDeletionError(String(error), exitCode)) { + return fail(error); + } + throw new GitResponseError(task.parser(bufferToString(stdOut), bufferToString(stdErr)), String(error)); + } + }; + return task; +} +var init_branch = __esm({ + "src/lib/tasks/branch.ts"() { + init_git_response_error(); + init_parse_branch_delete(); + init_parse_branch(); + init_utils(); + } +}); + +// src/lib/responses/CheckIgnore.ts +var parseCheckIgnore; +var init_CheckIgnore = __esm({ + "src/lib/responses/CheckIgnore.ts"() { + parseCheckIgnore = (text) => { + return text.split(/\n/g).map((line) => line.trim()).filter((file) => !!file); + }; + } +}); + +// src/lib/tasks/check-ignore.ts +var check_ignore_exports = {}; +__export(check_ignore_exports, { + checkIgnoreTask: () => checkIgnoreTask +}); +function checkIgnoreTask(paths) { + return { + commands: ["check-ignore", ...paths], + format: "utf-8", + parser: parseCheckIgnore + }; +} +var init_check_ignore = __esm({ + "src/lib/tasks/check-ignore.ts"() { + init_CheckIgnore(); + } +}); + +// src/lib/tasks/clone.ts +var clone_exports = {}; +__export(clone_exports, { + cloneMirrorTask: () => cloneMirrorTask, + cloneTask: () => cloneTask +}); +function cloneTask(repo, directory, customArgs) { + const commands = ["clone", ...customArgs]; + if (typeof repo === "string") { + commands.push(repo); + } + if (typeof directory === "string") { + commands.push(directory); + } + return straightThroughStringTask(commands); +} +function cloneMirrorTask(repo, directory, customArgs) { + append(customArgs, "--mirror"); + return cloneTask(repo, directory, customArgs); +} +var init_clone = __esm({ + "src/lib/tasks/clone.ts"() { + init_task(); + init_utils(); + } +}); + +// src/lib/parsers/parse-commit.ts +function parseCommitResult(stdOut) { + const result = { + author: null, + branch: "", + commit: "", + root: false, + summary: { + changes: 0, + insertions: 0, + deletions: 0 + } + }; + return parseStringResponse(result, parsers8, stdOut); +} +var parsers8; +var init_parse_commit = __esm({ + "src/lib/parsers/parse-commit.ts"() { + init_utils(); + parsers8 = [ + new LineParser(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/, (result, [branch, root, commit]) => { + result.branch = branch; + result.commit = commit; + result.root = !!root; + }), + new LineParser(/\s*Author:\s(.+)/i, (result, [author]) => { + const parts = author.split("<"); + const email = parts.pop(); + if (!email || !email.includes("@")) { + return; + } + result.author = { + email: email.substr(0, email.length - 1), + name: parts.join("<").trim() + }; + }), + new LineParser(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g, (result, [changes, insertions, deletions]) => { + result.summary.changes = parseInt(changes, 10) || 0; + result.summary.insertions = parseInt(insertions, 10) || 0; + result.summary.deletions = parseInt(deletions, 10) || 0; + }), + new LineParser(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/, (result, [changes, lines, direction]) => { + result.summary.changes = parseInt(changes, 10) || 0; + const count = parseInt(lines, 10) || 0; + if (direction === "-") { + result.summary.deletions = count; + } else if (direction === "+") { + result.summary.insertions = count; + } + }) + ]; + } +}); + +// src/lib/tasks/commit.ts +var commit_exports = {}; +__export(commit_exports, { + commitTask: () => commitTask +}); +function commitTask(message, files, customArgs) { + const commands = ["commit"]; + message.forEach((m) => commands.push("-m", m)); + commands.push(...files, ...customArgs); + return { + commands, + format: "utf-8", + parser: parseCommitResult + }; +} +var init_commit = __esm({ + "src/lib/tasks/commit.ts"() { + init_parse_commit(); + } +}); + +// src/lib/tasks/diff.ts +var diff_exports = {}; +__export(diff_exports, { + diffSummaryTask: () => diffSummaryTask +}); +function diffSummaryTask(customArgs) { + return { + commands: ["diff", "--stat=4096", ...customArgs], + format: "utf-8", + parser(stdOut) { + return parseDiffResult(stdOut); + } + }; +} +var init_diff = __esm({ + "src/lib/tasks/diff.ts"() { + init_parse_diff_summary(); + } +}); + +// src/lib/parsers/parse-fetch.ts +function parseFetchResult(stdOut, stdErr) { + const result = { + raw: stdOut, + remote: null, + branches: [], + tags: [] + }; + return parseStringResponse(result, parsers9, stdOut, stdErr); +} +var parsers9; +var init_parse_fetch = __esm({ + "src/lib/parsers/parse-fetch.ts"() { + init_utils(); + parsers9 = [ + new LineParser(/From (.+)$/, (result, [remote]) => { + result.remote = remote; + }), + new LineParser(/\* \[new branch]\s+(\S+)\s*-> (.+)$/, (result, [name, tracking]) => { + result.branches.push({ + name, + tracking + }); + }), + new LineParser(/\* \[new tag]\s+(\S+)\s*-> (.+)$/, (result, [name, tracking]) => { + result.tags.push({ + name, + tracking + }); + }) + ]; + } +}); + +// src/lib/tasks/fetch.ts +var fetch_exports = {}; +__export(fetch_exports, { + fetchTask: () => fetchTask +}); +function fetchTask(remote, branch, customArgs) { + const commands = ["fetch", ...customArgs]; + if (remote && branch) { + commands.push(remote, branch); + } + return { + commands, + format: "utf-8", + parser: parseFetchResult + }; +} +var init_fetch = __esm({ + "src/lib/tasks/fetch.ts"() { + init_parse_fetch(); + } +}); + +// src/lib/parsers/parse-move.ts +function parseMoveResult(stdOut) { + return parseStringResponse({ moves: [] }, parsers10, stdOut); +} +var parsers10; +var init_parse_move = __esm({ + "src/lib/parsers/parse-move.ts"() { + init_utils(); + parsers10 = [ + new LineParser(/^Renaming (.+) to (.+)$/, (result, [from, to]) => { + result.moves.push({ from, to }); + }) + ]; + } +}); + +// src/lib/tasks/move.ts +var move_exports = {}; +__export(move_exports, { + moveTask: () => moveTask +}); +function moveTask(from, to) { + return { + commands: ["mv", "-v", ...asArray(from), to], + format: "utf-8", + parser: parseMoveResult + }; +} +var init_move = __esm({ + "src/lib/tasks/move.ts"() { + init_parse_move(); + init_utils(); + } +}); + +// src/lib/tasks/pull.ts +var pull_exports = {}; +__export(pull_exports, { + pullTask: () => pullTask +}); +function pullTask(remote, branch, customArgs) { + const commands = ["pull", ...customArgs]; + if (remote && branch) { + commands.splice(1, 0, remote, branch); + } + return { + commands, + format: "utf-8", + parser(stdOut, stdErr) { + return parsePullResult(stdOut, stdErr); + }, + onError(result, _error, _done, fail) { + const pullError = parsePullErrorResult(bufferToString(result.stdOut), bufferToString(result.stdErr)); + if (pullError) { + return fail(new GitResponseError(pullError)); + } + fail(_error); + } + }; +} +var init_pull = __esm({ + "src/lib/tasks/pull.ts"() { + init_git_response_error(); + init_parse_pull(); + init_utils(); + } +}); + +// src/lib/responses/GetRemoteSummary.ts +function parseGetRemotes(text) { + const remotes = {}; + forEach(text, ([name]) => remotes[name] = { name }); + return Object.values(remotes); +} +function parseGetRemotesVerbose(text) { + const remotes = {}; + forEach(text, ([name, url, purpose]) => { + if (!remotes.hasOwnProperty(name)) { + remotes[name] = { + name, + refs: { fetch: "", push: "" } + }; + } + if (purpose && url) { + remotes[name].refs[purpose.replace(/[^a-z]/g, "")] = url; + } + }); + return Object.values(remotes); +} +function forEach(text, handler) { + forEachLineWithContent(text, (line) => handler(line.split(/\s+/))); +} +var init_GetRemoteSummary = __esm({ + "src/lib/responses/GetRemoteSummary.ts"() { + init_utils(); + } +}); + +// src/lib/tasks/remote.ts +var remote_exports = {}; +__export(remote_exports, { + addRemoteTask: () => addRemoteTask, + getRemotesTask: () => getRemotesTask, + listRemotesTask: () => listRemotesTask, + remoteTask: () => remoteTask, + removeRemoteTask: () => removeRemoteTask +}); +function addRemoteTask(remoteName, remoteRepo, customArgs = []) { + return straightThroughStringTask(["remote", "add", ...customArgs, remoteName, remoteRepo]); +} +function getRemotesTask(verbose) { + const commands = ["remote"]; + if (verbose) { + commands.push("-v"); + } + return { + commands, + format: "utf-8", + parser: verbose ? parseGetRemotesVerbose : parseGetRemotes + }; +} +function listRemotesTask(customArgs = []) { + const commands = [...customArgs]; + if (commands[0] !== "ls-remote") { + commands.unshift("ls-remote"); + } + return straightThroughStringTask(commands); +} +function remoteTask(customArgs = []) { + const commands = [...customArgs]; + if (commands[0] !== "remote") { + commands.unshift("remote"); + } + return straightThroughStringTask(commands); +} +function removeRemoteTask(remoteName) { + return straightThroughStringTask(["remote", "remove", remoteName]); +} +var init_remote = __esm({ + "src/lib/tasks/remote.ts"() { + init_GetRemoteSummary(); + init_task(); + } +}); + +// src/lib/tasks/stash-list.ts +var stash_list_exports = {}; +__export(stash_list_exports, { + stashListTask: () => stashListTask +}); +function stashListTask(opt = {}, customArgs) { + const options = parseLogOptions(opt); + const parser3 = createListLogSummaryParser(options.splitter, options.fields); + return { + commands: ["stash", "list", ...options.commands, ...customArgs], + format: "utf-8", + parser: parser3 + }; +} +var init_stash_list = __esm({ + "src/lib/tasks/stash-list.ts"() { + init_parse_list_log_summary(); + init_log(); + } +}); + +// src/lib/tasks/sub-module.ts +var sub_module_exports = {}; +__export(sub_module_exports, { + addSubModuleTask: () => addSubModuleTask, + initSubModuleTask: () => initSubModuleTask, + subModuleTask: () => subModuleTask, + updateSubModuleTask: () => updateSubModuleTask +}); +function addSubModuleTask(repo, path) { + return subModuleTask(["add", repo, path]); +} +function initSubModuleTask(customArgs) { + return subModuleTask(["init", ...customArgs]); +} +function subModuleTask(customArgs) { + const commands = [...customArgs]; + if (commands[0] !== "submodule") { + commands.unshift("submodule"); + } + return straightThroughStringTask(commands); +} +function updateSubModuleTask(customArgs) { + return subModuleTask(["update", ...customArgs]); +} +var init_sub_module = __esm({ + "src/lib/tasks/sub-module.ts"() { + init_task(); + } +}); + +// src/lib/responses/TagList.ts +function singleSorted(a, b) { + const aIsNum = isNaN(a); + const bIsNum = isNaN(b); + if (aIsNum !== bIsNum) { + return aIsNum ? 1 : -1; + } + return aIsNum ? sorted(a, b) : 0; +} +function sorted(a, b) { + return a === b ? 0 : a > b ? 1 : -1; +} +function trimmed(input) { + return input.trim(); +} +function toNumber(input) { + if (typeof input === "string") { + return parseInt(input.replace(/^\D+/g, ""), 10) || 0; + } + return 0; +} +var TagList, parseTagList; +var init_TagList = __esm({ + "src/lib/responses/TagList.ts"() { + TagList = class { + constructor(all, latest) { + this.all = all; + this.latest = latest; + } + }; + parseTagList = function(data, customSort = false) { + const tags = data.split("\n").map(trimmed).filter(Boolean); + if (!customSort) { + tags.sort(function(tagA, tagB) { + const partsA = tagA.split("."); + const partsB = tagB.split("."); + if (partsA.length === 1 || partsB.length === 1) { + return singleSorted(toNumber(partsA[0]), toNumber(partsB[0])); + } + for (let i = 0, l = Math.max(partsA.length, partsB.length); i < l; i++) { + const diff = sorted(toNumber(partsA[i]), toNumber(partsB[i])); + if (diff) { + return diff; + } + } + return 0; + }); + } + const latest = customSort ? tags[0] : [...tags].reverse().find((tag) => tag.indexOf(".") >= 0); + return new TagList(tags, latest); + }; + } +}); + +// src/lib/tasks/tag.ts +var tag_exports = {}; +__export(tag_exports, { + addAnnotatedTagTask: () => addAnnotatedTagTask, + addTagTask: () => addTagTask, + tagListTask: () => tagListTask +}); +function tagListTask(customArgs = []) { + const hasCustomSort = customArgs.some((option) => /^--sort=/.test(option)); + return { + format: "utf-8", + commands: ["tag", "-l", ...customArgs], + parser(text) { + return parseTagList(text, hasCustomSort); + } + }; +} +function addTagTask(name) { + return { + format: "utf-8", + commands: ["tag", name], + parser() { + return { name }; + } + }; +} +function addAnnotatedTagTask(name, tagMessage) { + return { + format: "utf-8", + commands: ["tag", "-a", "-m", tagMessage, name], + parser() { + return { name }; + } + }; +} +var init_tag = __esm({ + "src/lib/tasks/tag.ts"() { + init_TagList(); + } +}); + +// src/git.js +var require_git = __commonJS({ + "src/git.js"(exports, module) { + var { GitExecutor: GitExecutor2 } = (init_git_executor(), __toCommonJS(git_executor_exports)); + var { SimpleGitApi: SimpleGitApi2 } = (init_simple_git_api(), __toCommonJS(simple_git_api_exports)); + var { Scheduler: Scheduler2 } = (init_scheduler(), __toCommonJS(scheduler_exports)); + var { configurationErrorTask: configurationErrorTask2 } = (init_task(), __toCommonJS(task_exports)); + var { + asArray: asArray2, + filterArray: filterArray2, + filterPrimitives: filterPrimitives2, + filterString: filterString2, + filterStringOrStringArray: filterStringOrStringArray2, + filterType: filterType2, + getTrailingOptions: getTrailingOptions2, + trailingFunctionArgument: trailingFunctionArgument2, + trailingOptionsArgument: trailingOptionsArgument2 + } = (init_utils(), __toCommonJS(utils_exports)); + var { applyPatchTask: applyPatchTask2 } = (init_apply_patch(), __toCommonJS(apply_patch_exports)); + var { branchTask: branchTask2, branchLocalTask: branchLocalTask2, deleteBranchesTask: deleteBranchesTask2, deleteBranchTask: deleteBranchTask2 } = (init_branch(), __toCommonJS(branch_exports)); + var { checkIgnoreTask: checkIgnoreTask2 } = (init_check_ignore(), __toCommonJS(check_ignore_exports)); + var { checkIsRepoTask: checkIsRepoTask2 } = (init_check_is_repo(), __toCommonJS(check_is_repo_exports)); + var { cloneTask: cloneTask2, cloneMirrorTask: cloneMirrorTask2 } = (init_clone(), __toCommonJS(clone_exports)); + var { cleanWithOptionsTask: cleanWithOptionsTask2, isCleanOptionsArray: isCleanOptionsArray2 } = (init_clean(), __toCommonJS(clean_exports)); + var { commitTask: commitTask2 } = (init_commit(), __toCommonJS(commit_exports)); + var { diffSummaryTask: diffSummaryTask2 } = (init_diff(), __toCommonJS(diff_exports)); + var { fetchTask: fetchTask2 } = (init_fetch(), __toCommonJS(fetch_exports)); + var { moveTask: moveTask2 } = (init_move(), __toCommonJS(move_exports)); + var { pullTask: pullTask2 } = (init_pull(), __toCommonJS(pull_exports)); + var { pushTagsTask: pushTagsTask2 } = (init_push(), __toCommonJS(push_exports)); + var { addRemoteTask: addRemoteTask2, getRemotesTask: getRemotesTask2, listRemotesTask: listRemotesTask2, remoteTask: remoteTask2, removeRemoteTask: removeRemoteTask2 } = (init_remote(), __toCommonJS(remote_exports)); + var { getResetMode: getResetMode2, resetTask: resetTask2 } = (init_reset(), __toCommonJS(reset_exports)); + var { stashListTask: stashListTask2 } = (init_stash_list(), __toCommonJS(stash_list_exports)); + var { addSubModuleTask: addSubModuleTask2, initSubModuleTask: initSubModuleTask2, subModuleTask: subModuleTask2, updateSubModuleTask: updateSubModuleTask2 } = (init_sub_module(), __toCommonJS(sub_module_exports)); + var { addAnnotatedTagTask: addAnnotatedTagTask2, addTagTask: addTagTask2, tagListTask: tagListTask2 } = (init_tag(), __toCommonJS(tag_exports)); + var { straightThroughBufferTask: straightThroughBufferTask2, straightThroughStringTask: straightThroughStringTask2 } = (init_task(), __toCommonJS(task_exports)); + function Git2(options, plugins) { + this._executor = new GitExecutor2(options.binary, options.baseDir, new Scheduler2(options.maxConcurrentProcesses), plugins); + } + (Git2.prototype = Object.create(SimpleGitApi2.prototype)).constructor = Git2; + Git2.prototype.customBinary = function(command) { + this._executor.binary = command; + return this; + }; + Git2.prototype.env = function(name, value) { + if (arguments.length === 1 && typeof name === "object") { + this._executor.env = name; + } else { + (this._executor.env = this._executor.env || {})[name] = value; + } + return this; + }; + Git2.prototype.stashList = function(options) { + return this._runTask(stashListTask2(trailingOptionsArgument2(arguments) || {}, filterArray2(options) && options || []), trailingFunctionArgument2(arguments)); + }; + function createCloneTask(api, task, repoPath, localPath) { + if (typeof repoPath !== "string") { + return configurationErrorTask2(`git.${api}() requires a string 'repoPath'`); + } + return task(repoPath, filterType2(localPath, filterString2), getTrailingOptions2(arguments)); + } + Git2.prototype.clone = function() { + return this._runTask(createCloneTask("clone", cloneTask2, ...arguments), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.mirror = function() { + return this._runTask(createCloneTask("mirror", cloneMirrorTask2, ...arguments), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.mv = function(from, to) { + return this._runTask(moveTask2(from, to), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.checkoutLatestTag = function(then) { + var git = this; + return this.pull(function() { + git.tags(function(err, tags) { + git.checkout(tags.latest, then); + }); + }); + }; + Git2.prototype.commit = function(message, files, options, then) { + const next = trailingFunctionArgument2(arguments); + if (!filterStringOrStringArray2(message)) { + return this._runTask(configurationErrorTask2("git.commit: requires the commit message to be supplied as a string/string[]"), next); + } + return this._runTask(commitTask2(asArray2(message), asArray2(filterType2(files, filterStringOrStringArray2, [])), [...filterType2(options, filterArray2, []), ...getTrailingOptions2(arguments, 0, true)]), next); + }; + Git2.prototype.pull = function(remote, branch, options, then) { + return this._runTask(pullTask2(filterType2(remote, filterString2), filterType2(branch, filterString2), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.fetch = function(remote, branch) { + return this._runTask(fetchTask2(filterType2(remote, filterString2), filterType2(branch, filterString2), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.silent = function(silence) { + console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3"); + return this; + }; + Git2.prototype.tags = function(options, then) { + return this._runTask(tagListTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.rebase = function() { + return this._runTask(straightThroughStringTask2(["rebase", ...getTrailingOptions2(arguments)]), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.reset = function(mode) { + return this._runTask(resetTask2(getResetMode2(mode), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.revert = function(commit) { + const next = trailingFunctionArgument2(arguments); + if (typeof commit !== "string") { + return this._runTask(configurationErrorTask2("Commit must be a string"), next); + } + return this._runTask(straightThroughStringTask2(["revert", ...getTrailingOptions2(arguments, 0, true), commit]), next); + }; + Git2.prototype.addTag = function(name) { + const task = typeof name === "string" ? addTagTask2(name) : configurationErrorTask2("Git.addTag requires a tag name"); + return this._runTask(task, trailingFunctionArgument2(arguments)); + }; + Git2.prototype.addAnnotatedTag = function(tagName, tagMessage) { + return this._runTask(addAnnotatedTagTask2(tagName, tagMessage), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.checkout = function() { + const commands = ["checkout", ...getTrailingOptions2(arguments, true)]; + return this._runTask(straightThroughStringTask2(commands), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.checkoutBranch = function(branchName, startPoint, then) { + return this.checkout(["-b", branchName, startPoint], trailingFunctionArgument2(arguments)); + }; + Git2.prototype.checkoutLocalBranch = function(branchName, then) { + return this.checkout(["-b", branchName], trailingFunctionArgument2(arguments)); + }; + Git2.prototype.deleteLocalBranch = function(branchName, forceDelete, then) { + return this._runTask(deleteBranchTask2(branchName, typeof forceDelete === "boolean" ? forceDelete : false), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.deleteLocalBranches = function(branchNames, forceDelete, then) { + return this._runTask(deleteBranchesTask2(branchNames, typeof forceDelete === "boolean" ? forceDelete : false), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.branch = function(options, then) { + return this._runTask(branchTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.branchLocal = function(then) { + return this._runTask(branchLocalTask2(), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.raw = function(commands) { + const createRestCommands = !Array.isArray(commands); + const command = [].slice.call(createRestCommands ? arguments : commands, 0); + for (let i = 0; i < command.length && createRestCommands; i++) { + if (!filterPrimitives2(command[i])) { + command.splice(i, command.length - i); + break; + } + } + command.push(...getTrailingOptions2(arguments, 0, true)); + var next = trailingFunctionArgument2(arguments); + if (!command.length) { + return this._runTask(configurationErrorTask2("Raw: must supply one or more command to execute"), next); + } + return this._runTask(straightThroughStringTask2(command), next); + }; + Git2.prototype.submoduleAdd = function(repo, path, then) { + return this._runTask(addSubModuleTask2(repo, path), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.submoduleUpdate = function(args, then) { + return this._runTask(updateSubModuleTask2(getTrailingOptions2(arguments, true)), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.submoduleInit = function(args, then) { + return this._runTask(initSubModuleTask2(getTrailingOptions2(arguments, true)), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.subModule = function(options, then) { + return this._runTask(subModuleTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.listRemote = function() { + return this._runTask(listRemotesTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.addRemote = function(remoteName, remoteRepo, then) { + return this._runTask(addRemoteTask2(remoteName, remoteRepo, getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.removeRemote = function(remoteName, then) { + return this._runTask(removeRemoteTask2(remoteName), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.getRemotes = function(verbose, then) { + return this._runTask(getRemotesTask2(verbose === true), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.remote = function(options, then) { + return this._runTask(remoteTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.tag = function(options, then) { + const command = getTrailingOptions2(arguments); + if (command[0] !== "tag") { + command.unshift("tag"); + } + return this._runTask(straightThroughStringTask2(command), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.updateServerInfo = function(then) { + return this._runTask(straightThroughStringTask2(["update-server-info"]), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.pushTags = function(remote, then) { + const task = pushTagsTask2({ remote: filterType2(remote, filterString2) }, getTrailingOptions2(arguments)); + return this._runTask(task, trailingFunctionArgument2(arguments)); + }; + Git2.prototype.rm = function(files) { + return this._runTask(straightThroughStringTask2(["rm", "-f", ...asArray2(files)]), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.rmKeepLocal = function(files) { + return this._runTask(straightThroughStringTask2(["rm", "--cached", ...asArray2(files)]), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.catFile = function(options, then) { + return this._catFile("utf-8", arguments); + }; + Git2.prototype.binaryCatFile = function() { + return this._catFile("buffer", arguments); + }; + Git2.prototype._catFile = function(format, args) { + var handler = trailingFunctionArgument2(args); + var command = ["cat-file"]; + var options = args[0]; + if (typeof options === "string") { + return this._runTask(configurationErrorTask2("Git.catFile: options must be supplied as an array of strings"), handler); + } + if (Array.isArray(options)) { + command.push.apply(command, options); + } + const task = format === "buffer" ? straightThroughBufferTask2(command) : straightThroughStringTask2(command); + return this._runTask(task, handler); + }; + Git2.prototype.diff = function(options, then) { + const task = filterString2(options) ? configurationErrorTask2("git.diff: supplying options as a single string is no longer supported, switch to an array of strings") : straightThroughStringTask2(["diff", ...getTrailingOptions2(arguments)]); + return this._runTask(task, trailingFunctionArgument2(arguments)); + }; + Git2.prototype.diffSummary = function() { + return this._runTask(diffSummaryTask2(getTrailingOptions2(arguments, 1)), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.applyPatch = function(patches) { + const task = !filterStringOrStringArray2(patches) ? configurationErrorTask2(`git.applyPatch requires one or more string patches as the first argument`) : applyPatchTask2(asArray2(patches), getTrailingOptions2([].slice.call(arguments, 1))); + return this._runTask(task, trailingFunctionArgument2(arguments)); + }; + Git2.prototype.revparse = function() { + const commands = ["rev-parse", ...getTrailingOptions2(arguments, true)]; + return this._runTask(straightThroughStringTask2(commands, true), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.show = function(options, then) { + return this._runTask(straightThroughStringTask2(["show", ...getTrailingOptions2(arguments, 1)]), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.clean = function(mode, options, then) { + const usingCleanOptionsArray = isCleanOptionsArray2(mode); + const cleanMode = usingCleanOptionsArray && mode.join("") || filterType2(mode, filterString2) || ""; + const customArgs = getTrailingOptions2([].slice.call(arguments, usingCleanOptionsArray ? 1 : 0)); + return this._runTask(cleanWithOptionsTask2(cleanMode, customArgs), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.exec = function(then) { + const task = { + commands: [], + format: "utf-8", + parser() { + if (typeof then === "function") { + then(); + } + } + }; + return this._runTask(task); + }; + Git2.prototype.clearQueue = function() { + return this; + }; + Git2.prototype.checkIgnore = function(pathnames, then) { + return this._runTask(checkIgnoreTask2(asArray2(filterType2(pathnames, filterStringOrStringArray2, []))), trailingFunctionArgument2(arguments)); + }; + Git2.prototype.checkIsRepo = function(checkType, then) { + return this._runTask(checkIsRepoTask2(filterType2(checkType, filterString2)), trailingFunctionArgument2(arguments)); + }; + module.exports = Git2; + } +}); + +// src/lib/errors/git-construct-error.ts +init_git_error(); +var GitConstructError = class extends GitError { + constructor(config, message) { + super(void 0, message); + this.config = config; + } +}; + +// src/lib/api.ts +init_git_error(); + +// src/lib/errors/git-plugin-error.ts +init_git_error(); +var GitPluginError = class extends GitError { + constructor(task, plugin, message) { + super(task, message); + this.task = task; + this.plugin = plugin; + Object.setPrototypeOf(this, new.target.prototype); + } +}; + +// src/lib/api.ts +init_git_response_error(); +init_task_configuration_error(); +init_check_is_repo(); +init_clean(); +init_config(); +init_grep(); +init_reset(); + +// src/lib/plugins/command-config-prefixing-plugin.ts +init_utils(); +function commandConfigPrefixingPlugin(configuration) { + const prefix = prefixedArray(configuration, "-c"); + return { + type: "spawn.args", + action(data) { + return [...prefix, ...data]; + } + }; +} + +// src/lib/plugins/completion-detection.plugin.ts +init_utils(); +import { deferred } from "@kwsites/promise-deferred"; +var never = deferred().promise; +function completionDetectionPlugin({ + onClose = true, + onExit = 50 +} = {}) { + function createEvents() { + let exitCode = -1; + const events = { + close: deferred(), + closeTimeout: deferred(), + exit: deferred(), + exitTimeout: deferred() + }; + const result = Promise.race([ + onClose === false ? never : events.closeTimeout.promise, + onExit === false ? never : events.exitTimeout.promise + ]); + configureTimeout(onClose, events.close, events.closeTimeout); + configureTimeout(onExit, events.exit, events.exitTimeout); + return { + close(code) { + exitCode = code; + events.close.done(); + }, + exit(code) { + exitCode = code; + events.exit.done(); + }, + get exitCode() { + return exitCode; + }, + result + }; + } + function configureTimeout(flag, event, timeout) { + if (flag === false) { + return; + } + (flag === true ? event.promise : event.promise.then(() => delay(flag))).then(timeout.done); + } + return { + type: "spawn.after", + action(_0, _1) { + return __async(this, arguments, function* (_data, { spawned, close }) { + var _a2, _b; + const events = createEvents(); + let deferClose = true; + let quickClose = () => void (deferClose = false); + (_a2 = spawned.stdout) == null ? void 0 : _a2.on("data", quickClose); + (_b = spawned.stderr) == null ? void 0 : _b.on("data", quickClose); + spawned.on("error", quickClose); + spawned.on("close", (code) => events.close(code)); + spawned.on("exit", (code) => events.exit(code)); + try { + yield events.result; + if (deferClose) { + yield delay(50); + } + close(events.exitCode); + } catch (err) { + close(events.exitCode, err); + } + }); + } + }; +} + +// src/lib/plugins/error-detection.plugin.ts +init_git_error(); +function isTaskError(result) { + return !!(result.exitCode && result.stdErr.length); +} +function getErrorMessage(result) { + return Buffer.concat([...result.stdOut, ...result.stdErr]); +} +function errorDetectionHandler(overwrite = false, isError = isTaskError, errorMessage = getErrorMessage) { + return (error, result) => { + if (!overwrite && error || !isError(result)) { + return error; + } + return errorMessage(result); + }; +} +function errorDetectionPlugin(config) { + return { + type: "task.error", + action(data, context) { + const error = config(data.error, { + stdErr: context.stdErr, + stdOut: context.stdOut, + exitCode: context.exitCode + }); + if (Buffer.isBuffer(error)) { + return { error: new GitError(void 0, error.toString("utf-8")) }; + } + return { + error + }; + } + }; +} + +// src/lib/plugins/plugin-store.ts +init_utils(); +var PluginStore = class { + constructor() { + this.plugins = /* @__PURE__ */ new Set(); + } + add(plugin) { + const plugins = []; + asArray(plugin).forEach((plugin2) => plugin2 && this.plugins.add(append(plugins, plugin2))); + return () => { + plugins.forEach((plugin2) => this.plugins.delete(plugin2)); + }; + } + exec(type, data, context) { + let output = data; + const contextual = Object.freeze(Object.create(context)); + for (const plugin of this.plugins) { + if (plugin.type === type) { + output = plugin.action(output, contextual); + } + } + return output; + } +}; + +// src/lib/plugins/progress-monitor-plugin.ts +init_utils(); +function progressMonitorPlugin(progress) { + const progressCommand = "--progress"; + const progressMethods = ["checkout", "clone", "fetch", "pull", "push"]; + const onProgress = { + type: "spawn.after", + action(_data, context) { + var _a2; + if (!context.commands.includes(progressCommand)) { + return; + } + (_a2 = context.spawned.stderr) == null ? void 0 : _a2.on("data", (chunk) => { + const message = /^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(chunk.toString("utf8")); + if (!message) { + return; + } + progress({ + method: context.method, + stage: progressEventStage(message[1]), + progress: asNumber(message[2]), + processed: asNumber(message[3]), + total: asNumber(message[4]) + }); + }); + } + }; + const onArgs = { + type: "spawn.args", + action(args, context) { + if (!progressMethods.includes(context.method)) { + return args; + } + return including(args, progressCommand); + } + }; + return [onArgs, onProgress]; +} +function progressEventStage(input) { + return String(input.toLowerCase().split(" ", 1)) || "unknown"; +} + +// src/lib/plugins/spawn-options-plugin.ts +init_utils(); +function spawnOptionsPlugin(spawnOptions) { + const options = pick(spawnOptions, ["uid", "gid"]); + return { + type: "spawn.options", + action(data) { + return __spreadValues(__spreadValues({}, options), data); + } + }; +} + +// src/lib/plugins/timout-plugin.ts +function timeoutPlugin({ block }) { + if (block > 0) { + return { + type: "spawn.after", + action(_data, context) { + var _a2, _b; + let timeout; + function wait() { + timeout && clearTimeout(timeout); + timeout = setTimeout(kill, block); + } + function stop() { + var _a3, _b2; + (_a3 = context.spawned.stdout) == null ? void 0 : _a3.off("data", wait); + (_b2 = context.spawned.stderr) == null ? void 0 : _b2.off("data", wait); + context.spawned.off("exit", stop); + context.spawned.off("close", stop); + } + function kill() { + stop(); + context.kill(new GitPluginError(void 0, "timeout", `block timeout reached`)); + } + (_a2 = context.spawned.stdout) == null ? void 0 : _a2.on("data", wait); + (_b = context.spawned.stderr) == null ? void 0 : _b.on("data", wait); + context.spawned.on("exit", stop); + context.spawned.on("close", stop); + wait(); + } + }; + } +} + +// src/lib/git-factory.ts +init_utils(); +var Git = require_git(); +function gitInstanceFactory(baseDir, options) { + const plugins = new PluginStore(); + const config = createInstanceConfig(baseDir && (typeof baseDir === "string" ? { baseDir } : baseDir) || {}, options); + if (!folderExists(config.baseDir)) { + throw new GitConstructError(config, `Cannot use simple-git on a directory that does not exist`); + } + if (Array.isArray(config.config)) { + plugins.add(commandConfigPrefixingPlugin(config.config)); + } + plugins.add(completionDetectionPlugin(config.completion)); + config.progress && plugins.add(progressMonitorPlugin(config.progress)); + config.timeout && plugins.add(timeoutPlugin(config.timeout)); + config.spawnOptions && plugins.add(spawnOptionsPlugin(config.spawnOptions)); + plugins.add(errorDetectionPlugin(errorDetectionHandler(true))); + config.errors && plugins.add(errorDetectionPlugin(config.errors)); + return new Git(config, plugins); +} + +// src/lib/runners/promise-wrapped.ts +init_git_response_error(); +var functionNamesBuilderApi = [ + "customBinary", + "env", + "outputHandler", + "silent" +]; +var functionNamesPromiseApi = [ + "add", + "addAnnotatedTag", + "addConfig", + "addRemote", + "addTag", + "applyPatch", + "binaryCatFile", + "branch", + "branchLocal", + "catFile", + "checkIgnore", + "checkIsRepo", + "checkout", + "checkoutBranch", + "checkoutLatestTag", + "checkoutLocalBranch", + "clean", + "clone", + "commit", + "cwd", + "deleteLocalBranch", + "deleteLocalBranches", + "diff", + "diffSummary", + "exec", + "fetch", + "getRemotes", + "init", + "listConfig", + "listRemote", + "log", + "merge", + "mergeFromTo", + "mirror", + "mv", + "pull", + "push", + "pushTags", + "raw", + "rebase", + "remote", + "removeRemote", + "reset", + "revert", + "revparse", + "rm", + "rmKeepLocal", + "show", + "stash", + "stashList", + "status", + "subModule", + "submoduleAdd", + "submoduleInit", + "submoduleUpdate", + "tag", + "tags", + "updateServerInfo" +]; +function gitP(...args) { + let git; + let chain = Promise.resolve(); + try { + git = gitInstanceFactory(...args); + } catch (e) { + chain = Promise.reject(e); + } + function builderReturn() { + return promiseApi; + } + function chainReturn() { + return chain; + } + const promiseApi = [...functionNamesBuilderApi, ...functionNamesPromiseApi].reduce((api, name) => { + const isAsync = functionNamesPromiseApi.includes(name); + const valid = isAsync ? asyncWrapper(name, git) : syncWrapper(name, git, api); + const alternative = isAsync ? chainReturn : builderReturn; + Object.defineProperty(api, name, { + enumerable: false, + configurable: false, + value: git ? valid : alternative + }); + return api; + }, {}); + return promiseApi; + function asyncWrapper(fn, git2) { + return function(...args2) { + if (typeof args2[args2.length] === "function") { + throw new TypeError("Promise interface requires that handlers are not supplied inline, trailing function not allowed in call to " + fn); + } + return chain.then(function() { + return new Promise(function(resolve, reject) { + const callback = (err, result) => { + if (err) { + return reject(toError(err)); + } + resolve(result); + }; + args2.push(callback); + git2[fn].apply(git2, args2); + }); + }); + }; + } + function syncWrapper(fn, git2, api) { + return (...args2) => { + git2[fn](...args2); + return api; + }; + } +} +function toError(error) { + if (error instanceof Error) { + return error; + } + if (typeof error === "string") { + return new Error(error); + } + return new GitResponseError(error); +} + +// src/esm.mjs +var esm_default = gitInstanceFactory; +export { + CheckRepoActions, + CleanOptions, + GitConfigScope, + GitConstructError, + GitError, + GitPluginError, + GitResponseError, + ResetMode, + TaskConfigurationError, + esm_default as default, + gitP, + grepQueryBuilder +}; +//# sourceMappingURL=index.js.map diff --git a/node_modules/simple-git/esm/index.js.map b/node_modules/simple-git/esm/index.js.map new file mode 100644 index 0000000..5acc5ab --- /dev/null +++ b/node_modules/simple-git/esm/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../../src/lib/errors/git-error.ts", "../../src/lib/errors/git-response-error.ts", "../../src/lib/errors/task-configuration-error.ts", "../../src/lib/utils/util.ts", "../../src/lib/utils/argument-filters.ts", "../../src/lib/utils/exit-codes.ts", "../../src/lib/utils/git-output-streams.ts", "../../src/lib/utils/line-parser.ts", "../../src/lib/utils/simple-git-options.ts", "../../src/lib/utils/task-options.ts", "../../src/lib/utils/task-parser.ts", "../../src/lib/utils/index.ts", "../../src/lib/tasks/check-is-repo.ts", "../../src/lib/responses/CleanSummary.ts", "../../src/lib/tasks/task.ts", "../../src/lib/tasks/clean.ts", "../../src/lib/responses/ConfigList.ts", "../../src/lib/tasks/config.ts", "../../src/lib/tasks/grep.ts", "../../src/lib/tasks/reset.ts", "../../src/lib/git-logger.ts", "../../src/lib/runners/tasks-pending-queue.ts", "../../src/lib/runners/git-executor-chain.ts", "../../src/lib/runners/git-executor.ts", "../../src/lib/task-callback.ts", "../../src/lib/tasks/change-working-directory.ts", "../../src/lib/tasks/hash-object.ts", "../../src/lib/responses/InitSummary.ts", "../../src/lib/tasks/init.ts", "../../src/lib/responses/DiffSummary.ts", "../../src/lib/parsers/parse-diff-summary.ts", "../../src/lib/parsers/parse-list-log-summary.ts", "../../src/lib/tasks/log.ts", "../../src/lib/responses/MergeSummary.ts", "../../src/lib/responses/PullSummary.ts", "../../src/lib/parsers/parse-remote-objects.ts", "../../src/lib/parsers/parse-remote-messages.ts", "../../src/lib/parsers/parse-pull.ts", "../../src/lib/parsers/parse-merge.ts", "../../src/lib/tasks/merge.ts", "../../src/lib/parsers/parse-push.ts", "../../src/lib/tasks/push.ts", "../../src/lib/responses/FileStatusSummary.ts", "../../src/lib/responses/StatusSummary.ts", "../../src/lib/tasks/status.ts", "../../src/lib/simple-git-api.ts", "../../src/lib/runners/scheduler.ts", "../../src/lib/tasks/apply-patch.ts", "../../src/lib/responses/BranchDeleteSummary.ts", "../../src/lib/parsers/parse-branch-delete.ts", "../../src/lib/responses/BranchSummary.ts", "../../src/lib/parsers/parse-branch.ts", "../../src/lib/tasks/branch.ts", "../../src/lib/responses/CheckIgnore.ts", "../../src/lib/tasks/check-ignore.ts", "../../src/lib/tasks/clone.ts", "../../src/lib/parsers/parse-commit.ts", "../../src/lib/tasks/commit.ts", "../../src/lib/tasks/diff.ts", "../../src/lib/parsers/parse-fetch.ts", "../../src/lib/tasks/fetch.ts", "../../src/lib/parsers/parse-move.ts", "../../src/lib/tasks/move.ts", "../../src/lib/tasks/pull.ts", "../../src/lib/responses/GetRemoteSummary.ts", "../../src/lib/tasks/remote.ts", "../../src/lib/tasks/stash-list.ts", "../../src/lib/tasks/sub-module.ts", "../../src/lib/responses/TagList.ts", "../../src/lib/tasks/tag.ts", "../../src/git.js", "../../src/lib/errors/git-construct-error.ts", "../../src/lib/api.ts", "../../src/lib/errors/git-plugin-error.ts", "../../src/lib/plugins/command-config-prefixing-plugin.ts", "../../src/lib/plugins/completion-detection.plugin.ts", "../../src/lib/plugins/error-detection.plugin.ts", "../../src/lib/plugins/plugin-store.ts", "../../src/lib/plugins/progress-monitor-plugin.ts", "../../src/lib/plugins/spawn-options-plugin.ts", "../../src/lib/plugins/timout-plugin.ts", "../../src/lib/git-factory.ts", "../../src/lib/runners/promise-wrapped.ts", "../../src/esm.mjs"], + "sourcesContent": ["import { SimpleGitTask } from '../types';\n\n/**\n * The `GitError` is thrown when the underlying `git` process throws a\n * fatal exception (eg an `ENOENT` exception when attempting to use a\n * non-writable directory as the root for your repo), and acts as the\n * base class for more specific errors thrown by the parsing of the\n * git response or errors in the configuration of the task about to\n * be run.\n *\n * When an exception is thrown, pending tasks in the same instance will\n * not be executed. The recommended way to run a series of tasks that\n * can independently fail without needing to prevent future tasks from\n * running is to catch them individually:\n *\n * ```typescript\n import { gitP, SimpleGit, GitError, PullResult } from 'simple-git';\n\n function catchTask (e: GitError) {\n return e.\n }\n\n const git = gitP(repoWorkingDir);\n const pulled: PullResult | GitError = await git.pull().catch(catchTask);\n const pushed: string | GitError = await git.pushTags().catch(catchTask);\n ```\n */\nexport class GitError extends Error {\n\n constructor (\n public task?: SimpleGitTask<any>,\n message?: string,\n ) {\n super(message);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n}\n", "import { GitError } from './git-error';\n\n/**\n * The `GitResponseError` is the wrapper for a parsed response that is treated as\n * a fatal error, for example attempting a `merge` can leave the repo in a corrupted\n * state when there are conflicts so the task will reject rather than resolve.\n *\n * For example, catching the merge conflict exception:\n *\n * ```typescript\n import { gitP, SimpleGit, GitResponseError, MergeSummary } from 'simple-git';\n\n const git = gitP(repoRoot);\n const mergeOptions: string[] = ['--no-ff', 'other-branch'];\n const mergeSummary: MergeSummary = await git.merge(mergeOptions)\n .catch((e: GitResponseError<MergeSummary>) => e.git);\n\n if (mergeSummary.failed) {\n // deal with the error\n }\n ```\n */\nexport class GitResponseError<T = any> extends GitError {\n\n constructor(\n /**\n * `.git` access the parsed response that is treated as being an error\n */\n public readonly git: T,\n message?: string,\n ) {\n super(undefined, message || String(git));\n }\n\n}\n", "import { GitError } from './git-error';\n\n/**\n * The `TaskConfigurationError` is thrown when a command was incorrectly\n * configured. An error of this kind means that no attempt was made to\n * run your command through the underlying `git` binary.\n *\n * Check the `.message` property for more detail on why your configuration\n * resulted in an error.\n */\nexport class TaskConfigurationError extends GitError {\n\n constructor (\n message?: string,\n ) {\n super(undefined, message);\n }\n\n}\n", "import { exists, FOLDER } from '@kwsites/file-exists';\nimport { Maybe } from '../types';\n\nexport const NULL = '\\0';\n\nexport const NOOP: (...args: any[]) => void = () => {\n};\n\n/**\n * Returns either the source argument when it is a `Function`, or the default\n * `NOOP` function constant\n */\nexport function asFunction<T extends () => any>(source: T | any): T {\n return typeof source === 'function' ? source : NOOP;\n}\n\n/**\n * Determines whether the supplied argument is both a function, and is not\n * the `NOOP` function.\n */\nexport function isUserFunction<T extends Function>(source: T | any): source is T {\n return (typeof source === 'function' && source !== NOOP);\n}\n\nexport function splitOn(input: string, char: string): [string, string] {\n const index = input.indexOf(char);\n if (index <= 0) {\n return [input, ''];\n }\n\n return [\n input.substr(0, index),\n input.substr(index + 1),\n ];\n}\n\nexport function first<T extends any[]>(input: T, offset?: number): Maybe<T[number]>;\nexport function first<T extends IArguments>(input: T, offset?: number): Maybe<unknown>;\nexport function first(input: any[] | IArguments, offset = 0): Maybe<unknown> {\n return isArrayLike(input) && input.length > offset ? input[offset] : undefined;\n}\n\nexport function last<T extends any[]>(input: T, offset?: number): Maybe<T[number]>;\nexport function last<T extends IArguments>(input: T, offset?: number): Maybe<unknown>;\nexport function last<T>(input: T, offset?: number): Maybe<unknown>;\nexport function last(input: unknown, offset = 0) {\n if (isArrayLike(input) && input.length > offset) {\n return input[input.length - 1 - offset];\n }\n}\n\ntype ArrayLike<T = any> = T[] | IArguments | { [index: number]: T; length: number };\n\nfunction isArrayLike(input: any): input is ArrayLike {\n return !!(input && typeof input.length === 'number');\n}\n\nexport function toLinesWithContent(input = '', trimmed = true, separator = '\\n'): string[] {\n return input.split(separator)\n .reduce((output, line) => {\n const lineContent = trimmed ? line.trim() : line;\n if (lineContent) {\n output.push(lineContent);\n }\n return output;\n }, [] as string[]);\n}\n\ntype LineWithContentCallback<T = void> = (line: string) => T;\n\nexport function forEachLineWithContent<T>(input: string, callback: LineWithContentCallback<T>): T[] {\n return toLinesWithContent(input, true).map(line => callback(line));\n}\n\nexport function folderExists(path: string): boolean {\n return exists(path, FOLDER);\n}\n\n/**\n * Adds `item` into the `target` `Array` or `Set` when it is not already present and returns the `item`.\n */\nexport function append<T>(target: T[] | Set<T>, item: T): typeof item {\n if (Array.isArray(target)) {\n if (!target.includes(item)) {\n target.push(item);\n }\n } else {\n target.add(item);\n }\n return item;\n}\n\n/**\n * Adds `item` into the `target` `Array` when it is not already present and returns the `target`.\n */\nexport function including<T>(target: T[], item: T): typeof target {\n if (Array.isArray(target) && !target.includes(item)) {\n target.push(item);\n }\n\n return target;\n}\n\nexport function remove<T>(target: Set<T> | T[], item: T): T {\n if (Array.isArray(target)) {\n const index = target.indexOf(item);\n if (index >= 0) {\n target.splice(index, 1);\n }\n } else {\n target.delete(item);\n }\n return item;\n}\n\nexport const objectToString = Object.prototype.toString.call.bind(Object.prototype.toString) as (input: any) => string;\n\nexport function asArray<T>(source: T | T[]): T[] {\n return Array.isArray(source) ? source : [source];\n}\n\nexport function asStringArray<T>(source: T | T[]): string[] {\n return asArray(source).map(String);\n}\n\nexport function asNumber(source: string | null | undefined, onNaN = 0) {\n if (source == null) {\n return onNaN;\n }\n\n const num = parseInt(source, 10);\n return isNaN(num) ? onNaN : num;\n}\n\nexport function prefixedArray<T>(input: T[], prefix: T): T[] {\n const output: T[] = [];\n for (let i = 0, max = input.length; i < max; i++) {\n output.push(prefix, input[i]);\n }\n return output;\n}\n\nexport function bufferToString(input: Buffer | Buffer[]): string {\n return (Array.isArray(input) ? Buffer.concat(input) : input).toString('utf-8');\n}\n\n/**\n * Get a new object from a source object with only the listed properties.\n */\nexport function pick(source: Record<string, any>, properties: string[]) {\n return Object.assign({}, ...properties.map((property) => property in source ? {[property]: source[property]} : {}));\n}\n\nexport function delay(duration = 0): Promise<void> {\n return new Promise(done => setTimeout(done, duration));\n}\n", "import { Maybe, Options, Primitives } from '../types';\nimport { objectToString } from './util';\n\nexport interface ArgumentFilterPredicate<T> {\n (input: any): input is T;\n}\n\nexport function filterType<T, K>(input: K, filter: ArgumentFilterPredicate<T>): K extends T ? T : undefined;\nexport function filterType<T, K>(input: K, filter: ArgumentFilterPredicate<T>, def: T): T;\nexport function filterType<T, K>(input: K, filter: ArgumentFilterPredicate<T>, def?: T): Maybe<T> {\n if (filter(input)) {\n return input;\n }\n return (arguments.length > 2) ? def : undefined\n}\n\nexport const filterArray: ArgumentFilterPredicate<Array<any>> = (input): input is Array<any> => {\n return Array.isArray(input);\n}\n\nexport function filterPrimitives(input: unknown, omit?: Array<'boolean' | 'string' | 'number'>): input is Primitives {\n return /number|string|boolean/.test(typeof input) && (!omit || !omit.includes((typeof input) as 'boolean' | 'string' | 'number'));\n}\n\nexport const filterString: ArgumentFilterPredicate<string> = (input): input is string => {\n return typeof input === 'string';\n};\n\nexport const filterStringArray: ArgumentFilterPredicate<string[]> = (input): input is string[] => {\n return Array.isArray(input) && input.every(filterString);\n};\n\nexport const filterStringOrStringArray: ArgumentFilterPredicate<string | string[]> = (input): input is string | string[] => {\n return filterString(input) || (Array.isArray(input) && input.every(filterString));\n};\n\nexport function filterPlainObject<T extends Options>(input: T | unknown): input is T;\nexport function filterPlainObject<T extends Object>(input: T | unknown): input is T {\n return !!input && objectToString(input) === '[object Object]';\n}\n\nexport function filterFunction(input: unknown): input is Function {\n return typeof input === 'function';\n}\n\nexport const filterHasLength: ArgumentFilterPredicate<{ length: number }> = (input): input is { length: number } => {\n if (input == null || 'number|boolean|function'.includes(typeof input)) {\n return false;\n }\n return Array.isArray(input) || typeof input === 'string' || typeof input.length === 'number';\n}\n", "/**\n * Known process exit codes used by the task parsers to determine whether an error\n * was one they can automatically handle\n */\nexport enum ExitCodes {\n SUCCESS,\n ERROR,\n UNCLEAN = 128,\n}\n", "import { TaskResponseFormat } from '../types';\n\nexport class GitOutputStreams<T extends TaskResponseFormat = Buffer> {\n\n constructor(public readonly stdOut: T, public readonly stdErr: T) {\n }\n\n asStrings(): GitOutputStreams<string> {\n return new GitOutputStreams(this.stdOut.toString('utf8'), this.stdErr.toString('utf8'));\n }\n}\n", "export class LineParser<T> {\n\n protected matches: string[] = [];\n\n private _regExp: RegExp[];\n\n constructor(\n regExp: RegExp | RegExp[],\n useMatches?: (target: T, match: string[]) => boolean | void,\n ) {\n this._regExp = Array.isArray(regExp) ? regExp : [regExp];\n if (useMatches) {\n this.useMatches = useMatches;\n }\n }\n\n parse = (line: (offset: number) => (string | undefined), target: T): boolean => {\n this.resetMatches();\n\n if (!this._regExp.every((reg, index) => this.addMatch(reg, index, line(index)))) {\n return false;\n }\n\n return this.useMatches(target, this.prepareMatches()) !== false;\n }\n\n // @ts-ignore\n protected useMatches(target: T, match: string[]): boolean | void {\n throw new Error(`LineParser:useMatches not implemented`);\n }\n\n protected resetMatches() {\n this.matches.length = 0;\n }\n\n protected prepareMatches() {\n return this.matches;\n }\n\n protected addMatch(reg: RegExp, index: number, line?: string) {\n const matched = line && reg.exec(line);\n if (matched) {\n this.pushMatch(index, matched);\n }\n\n return !!matched;\n }\n\n protected pushMatch(_index: number, matched: string[]) {\n this.matches.push(...matched.slice(1));\n }\n\n}\n\nexport class RemoteLineParser<T> extends LineParser<T> {\n\n protected addMatch(reg: RegExp, index: number, line?: string): boolean {\n return /^remote:\\s/.test(String(line)) && super.addMatch(reg, index, line);\n }\n\n protected pushMatch(index: number, matched: string[]) {\n if (index > 0 || matched.length > 1) {\n super.pushMatch(index, matched);\n }\n }\n\n}\n", "import { SimpleGitOptions } from '../types';\n\nconst defaultOptions: Omit<SimpleGitOptions, 'baseDir'> = {\n binary: 'git',\n maxConcurrentProcesses: 5,\n config: [],\n};\n\nexport function createInstanceConfig(...options: Array<Partial<SimpleGitOptions> | undefined>): SimpleGitOptions {\n const baseDir = process.cwd();\n const config: SimpleGitOptions = Object.assign({baseDir, ...defaultOptions},\n ...(options.filter(o => typeof o === 'object' && o))\n );\n\n config.baseDir = config.baseDir || baseDir;\n\n return config;\n}\n", "import { filterArray, filterFunction, filterPlainObject, filterPrimitives, filterType } from './argument-filters';\nimport { asFunction, isUserFunction, last } from './util';\nimport { Maybe, Options, OptionsValues } from '../types';\n\nexport function appendTaskOptions<T extends Options = Options>(options: Maybe<T>, commands: string[] = []): string[] {\n if (!filterPlainObject<Options>(options)) {\n return commands;\n }\n\n return Object.keys(options).reduce((commands: string[], key: string) => {\n const value: OptionsValues = options[key];\n\n if (filterPrimitives(value, ['boolean'])) {\n commands.push(key + '=' + value);\n } else {\n commands.push(key);\n }\n\n return commands;\n }, commands);\n}\n\nexport function getTrailingOptions(args: IArguments, initialPrimitive = 0, objectOnly = false): string[] {\n const command: string[] = [];\n\n for (let i = 0, max = initialPrimitive < 0 ? args.length : initialPrimitive; i < max; i++) {\n if ('string|number'.includes(typeof args[i])) {\n command.push(String(args[i]));\n }\n }\n\n appendTaskOptions(trailingOptionsArgument(args), command);\n if (!objectOnly) {\n command.push(...trailingArrayArgument(args));\n }\n\n return command;\n}\n\nfunction trailingArrayArgument(args: IArguments) {\n const hasTrailingCallback = typeof last(args) === 'function';\n return filterType(\n last(args, hasTrailingCallback ? 1 : 0), filterArray, []\n );\n}\n\n/**\n * Given any number of arguments, returns the trailing options argument, ignoring a trailing function argument\n * if there is one. When not found, the return value is null.\n */\nexport function trailingOptionsArgument(args: IArguments): Maybe<Options> {\n const hasTrailingCallback = filterFunction(last(args));\n return filterType(last(args, hasTrailingCallback ? 1 : 0), filterPlainObject);\n}\n\n/**\n * Returns either the source argument when it is a `Function`, or the default\n * `NOOP` function constant\n */\nexport function trailingFunctionArgument(args: unknown[] | IArguments | unknown, includeNoop = true): Maybe<(...args: any[]) => unknown> {\n const callback = asFunction(last(args));\n return includeNoop || isUserFunction(callback) ? callback : undefined;\n}\n", "import { TaskParser, TaskResponseFormat } from '../types';\nimport { GitOutputStreams } from './git-output-streams';\nimport { LineParser } from './line-parser';\nimport { toLinesWithContent } from './util';\n\nexport function callTaskParser<INPUT extends TaskResponseFormat, RESPONSE>(parser: TaskParser<INPUT, RESPONSE>, streams: GitOutputStreams<INPUT>) {\n return parser(streams.stdOut, streams.stdErr);\n}\n\nexport function parseStringResponse<T>(result: T, parsers: LineParser<T>[], ...texts: string[]): T {\n texts.forEach(text => {\n for (let lines = toLinesWithContent(text), i = 0, max = lines.length; i < max; i++) {\n const line = (offset = 0) => {\n if ((i + offset) >= max) {\n return;\n }\n return lines[i + offset];\n }\n\n parsers.some(({parse}) => parse(line, result));\n }\n });\n\n return result;\n}\n", "\nexport * from './argument-filters';\nexport * from './exit-codes';\nexport * from './git-output-streams';\nexport * from './line-parser';\nexport * from './simple-git-options';\nexport * from './task-options';\nexport * from './task-parser';\nexport * from './util';\n", "import { ExitCodes } from '../utils';\nimport { Maybe, StringTask } from '../types';\n\nexport enum CheckRepoActions {\n BARE = 'bare',\n IN_TREE = 'tree',\n IS_REPO_ROOT = 'root',\n}\n\nconst onError: StringTask<boolean>['onError'] = ({exitCode}, error, done, fail) => {\n if (exitCode === ExitCodes.UNCLEAN && isNotRepoMessage(error)) {\n return done(Buffer.from('false'));\n }\n\n fail(error);\n}\n\nconst parser: StringTask<boolean>['parser'] = (text) => {\n return text.trim() === 'true';\n}\n\nexport function checkIsRepoTask(action: Maybe<CheckRepoActions>): StringTask<boolean> {\n switch (action) {\n case CheckRepoActions.BARE:\n return checkIsBareRepoTask();\n case CheckRepoActions.IS_REPO_ROOT:\n return checkIsRepoRootTask();\n }\n\n const commands = ['rev-parse', '--is-inside-work-tree'];\n\n return {\n commands,\n format: 'utf-8',\n onError,\n parser,\n }\n}\n\n\nexport function checkIsRepoRootTask(): StringTask<boolean> {\n const commands = ['rev-parse', '--git-dir'];\n\n return {\n commands,\n format: 'utf-8',\n onError,\n parser(path) {\n return /^\\.(git)?$/.test(path.trim());\n },\n }\n}\n\n\nexport function checkIsBareRepoTask(): StringTask<boolean> {\n const commands = ['rev-parse', '--is-bare-repository'];\n\n return {\n commands,\n format: 'utf-8',\n onError,\n parser,\n }\n}\n\n\nfunction isNotRepoMessage(error: Error): boolean {\n return /(Not a git repository|Kein Git-Repository)/i.test(String(error));\n}\n", "import { CleanSummary } from '../../../typings';\nimport { toLinesWithContent } from '../utils';\n\nexport class CleanResponse implements CleanSummary {\n\n public paths: string[] = [];\n public files: string[] = [];\n public folders: string[] = [];\n\n constructor(\n public readonly dryRun: boolean,\n ) {}\n\n}\n\nconst removalRegexp = /^[a-z]+\\s*/i;\nconst dryRunRemovalRegexp = /^[a-z]+\\s+[a-z]+\\s*/i;\nconst isFolderRegexp = /\\/$/;\n\nexport function cleanSummaryParser (dryRun: boolean, text: string): CleanSummary {\n const summary = new CleanResponse(dryRun);\n const regexp = dryRun ? dryRunRemovalRegexp : removalRegexp;\n\n toLinesWithContent(text).forEach(line => {\n const removed = line.replace(regexp, '');\n\n summary.paths.push(removed);\n (isFolderRegexp.test(removed) ? summary.folders : summary.files).push(removed);\n });\n\n return summary;\n}\n", "import { TaskConfigurationError } from '../errors/task-configuration-error';\nimport { BufferTask, EmptyTaskParser, SimpleGitTask, StringTask } from '../types';\n\nexport const EMPTY_COMMANDS: [] = [];\n\nexport type EmptyTask = {\n commands: typeof EMPTY_COMMANDS;\n format: 'empty',\n parser: EmptyTaskParser;\n onError?: undefined;\n};\n\n\nexport function adhocExecTask(parser: EmptyTaskParser): EmptyTask {\n return {\n commands: EMPTY_COMMANDS,\n format: 'empty',\n parser,\n };\n}\n\nexport function configurationErrorTask(error: Error | string): EmptyTask {\n return {\n commands: EMPTY_COMMANDS,\n format: 'empty',\n parser() {\n throw typeof error === 'string' ? new TaskConfigurationError(error) : error;\n }\n }\n}\n\nexport function straightThroughStringTask(commands: string[], trimmed = false): StringTask<string> {\n return {\n commands,\n format: 'utf-8',\n parser(text) {\n return trimmed ? String(text).trim() : text;\n },\n }\n}\n\nexport function straightThroughBufferTask(commands: string[]): BufferTask<any> {\n return {\n commands,\n format: 'buffer',\n parser(buffer) {\n return buffer;\n },\n }\n}\n\nexport function isBufferTask<R>(task: SimpleGitTask<R>): task is BufferTask<R> {\n return task.format === 'buffer';\n}\n\nexport function isEmptyTask<R>(task: SimpleGitTask<R>): task is EmptyTask {\n return task.format === 'empty' || !task.commands.length;\n}\n", "import { CleanSummary } from '../../../typings';\nimport { cleanSummaryParser } from '../responses/CleanSummary';\nimport { Maybe, StringTask } from '../types';\nimport { asStringArray } from '../utils';\nimport { configurationErrorTask } from './task';\n\nexport const CONFIG_ERROR_INTERACTIVE_MODE = 'Git clean interactive mode is not supported';\nexport const CONFIG_ERROR_MODE_REQUIRED = 'Git clean mode parameter (\"n\" or \"f\") is required';\nexport const CONFIG_ERROR_UNKNOWN_OPTION = 'Git clean unknown option found in: ';\n\n/**\n * All supported option switches available for use in a `git.clean` operation\n */\nexport enum CleanOptions {\n DRY_RUN = 'n',\n FORCE = 'f',\n IGNORED_INCLUDED = 'x',\n IGNORED_ONLY = 'X',\n EXCLUDING = 'e',\n QUIET = 'q',\n RECURSIVE = 'd',\n}\n\n/**\n * The two modes `git.clean` can run in - one of these must be supplied in order\n * for the command to not throw a `TaskConfigurationError`\n */\nexport type CleanMode = CleanOptions.FORCE | CleanOptions.DRY_RUN;\n\nconst CleanOptionValues: Set<string> = new Set(['i', ...asStringArray(Object.values(CleanOptions as any))]);\n\nexport function cleanWithOptionsTask(mode: CleanMode | string, customArgs: string[]) {\n const {cleanMode, options, valid} = getCleanOptions(mode);\n\n if (!cleanMode) {\n return configurationErrorTask(CONFIG_ERROR_MODE_REQUIRED);\n }\n\n if (!valid.options) {\n return configurationErrorTask(CONFIG_ERROR_UNKNOWN_OPTION + JSON.stringify(mode));\n }\n\n options.push(...customArgs);\n\n if (options.some(isInteractiveMode)) {\n return configurationErrorTask(CONFIG_ERROR_INTERACTIVE_MODE);\n }\n\n return cleanTask(cleanMode, options);\n}\n\nexport function cleanTask(mode: CleanMode, customArgs: string[]): StringTask<CleanSummary> {\n const commands: string[] = ['clean', `-${mode}`, ...customArgs];\n\n return {\n commands,\n format: 'utf-8',\n parser(text: string): CleanSummary {\n return cleanSummaryParser(mode === CleanOptions.DRY_RUN, text);\n }\n }\n}\n\nexport function isCleanOptionsArray (input: string[]): input is CleanOptions[] {\n return Array.isArray(input) && input.every(test => CleanOptionValues.has(test));\n}\n\nfunction getCleanOptions(input: string) {\n let cleanMode: Maybe<CleanMode>;\n let options: string[] = [];\n let valid = {cleanMode: false, options: true};\n\n input.replace(/[^a-z]i/g, '').split('').forEach(char => {\n if (isCleanMode(char)) {\n cleanMode = char;\n valid.cleanMode = true;\n }\n else {\n valid.options = valid.options && isKnownOption(options[options.length] = (`-${char}`));\n }\n });\n\n return {\n cleanMode,\n options,\n valid,\n }\n}\n\nfunction isCleanMode(cleanMode?: string): cleanMode is CleanMode {\n return cleanMode === CleanOptions.FORCE || cleanMode === CleanOptions.DRY_RUN;\n}\n\nfunction isKnownOption(option: string): boolean {\n return /^-[a-z]$/i.test(option) && CleanOptionValues.has(option.charAt(1));\n}\n\nfunction isInteractiveMode(option: string): boolean {\n if (/^-[^\\-]/.test(option)) {\n return option.indexOf('i') > 0;\n }\n\n return option === '--interactive';\n}\n", "import { ConfigGetResult, ConfigListSummary, ConfigValues } from '../../../typings';\nimport { last, splitOn } from '../utils';\n\nexport class ConfigList implements ConfigListSummary {\n\n public files: string[] = [];\n public values: { [fileName: string]: ConfigValues } = Object.create(null);\n\n private _all: ConfigValues | undefined;\n\n public get all(): ConfigValues {\n if (!this._all) {\n this._all = this.files.reduce((all: ConfigValues, file: string) => {\n return Object.assign(all, this.values[file]);\n }, {});\n }\n\n return this._all;\n }\n\n public addFile(file: string): ConfigValues {\n if (!(file in this.values)) {\n const latest = last(this.files);\n this.values[file] = latest ? Object.create(this.values[latest]) : {}\n\n this.files.push(file);\n }\n\n return this.values[file];\n }\n\n public addValue(file: string, key: string, value: string) {\n const values = this.addFile(file);\n\n if (!values.hasOwnProperty(key)) {\n values[key] = value;\n } else if (Array.isArray(values[key])) {\n (values[key] as string[]).push(value);\n } else {\n values[key] = [values[key] as string, value];\n }\n\n this._all = undefined;\n }\n\n}\n\nexport function configListParser(text: string): ConfigList {\n const config = new ConfigList();\n\n for (const item of configParser(text)) {\n config.addValue(item.file, String(item.key), item.value);\n }\n\n return config;\n}\n\nexport function configGetParser(text: string, key: string): ConfigGetResult {\n let value: string | null = null;\n const values: string[] = [];\n const scopes: Map<string, string[]> = new Map();\n\n for (const item of configParser(text, key)) {\n if (item.key !== key) {\n continue;\n }\n\n values.push(value = item.value);\n\n if (!scopes.has(item.file)) {\n scopes.set(item.file, []);\n }\n\n scopes.get(item.file)!.push(value);\n }\n\n return {\n key,\n paths: Array.from(scopes.keys()),\n scopes,\n value,\n values\n };\n}\n\nfunction configFilePath(filePath: string): string {\n return filePath.replace(/^(file):/, '');\n}\n\nfunction* configParser(text: string, requestedKey: string | null = null) {\n const lines = text.split('\\0');\n\n for (let i = 0, max = lines.length - 1; i < max;) {\n const file = configFilePath(lines[i++]);\n\n let value = lines[i++];\n let key = requestedKey;\n\n if (value.includes('\\n')) {\n const line = splitOn(value, '\\n');\n key = line[0];\n value = line[1];\n }\n\n yield {file, key, value};\n }\n}\n", "import { ConfigGetResult, ConfigListSummary, SimpleGit } from '../../../typings';\nimport { configGetParser, configListParser } from '../responses/ConfigList';\nimport { SimpleGitApi } from '../simple-git-api';\nimport { StringTask } from '../types';\nimport { trailingFunctionArgument } from '../utils';\n\nexport enum GitConfigScope {\n system = 'system',\n global = 'global',\n local = 'local',\n worktree = 'worktree',\n}\n\nfunction asConfigScope<T extends GitConfigScope | undefined>(scope: GitConfigScope | unknown, fallback: T): GitConfigScope | T {\n if (typeof scope === 'string' && GitConfigScope.hasOwnProperty(scope)) {\n return scope as GitConfigScope;\n }\n return fallback;\n}\n\nfunction addConfigTask(key: string, value: string, append: boolean, scope: GitConfigScope): StringTask<string> {\n const commands: string[] = ['config', `--${scope}`];\n\n if (append) {\n commands.push('--add');\n }\n\n commands.push(key, value);\n\n return {\n commands,\n format: 'utf-8',\n parser(text: string): string {\n return text;\n }\n }\n}\n\nfunction getConfigTask(key: string, scope?: GitConfigScope): StringTask<ConfigGetResult> {\n const commands: string[] = ['config', '--null', '--show-origin', '--get-all', key];\n\n if (scope) {\n commands.splice(1, 0, `--${scope}`);\n }\n\n return {\n commands,\n format: 'utf-8',\n parser(text) {\n return configGetParser(text, key);\n }\n };\n}\n\nfunction listConfigTask(scope?: GitConfigScope): StringTask<ConfigListSummary> {\n const commands = ['config', '--list', '--show-origin', '--null'];\n\n if (scope) {\n commands.push(`--${scope}`);\n }\n\n return {\n commands,\n format: 'utf-8',\n parser(text: string) {\n return configListParser(text);\n },\n }\n}\n\nexport default function (): Pick<SimpleGit, 'addConfig' | 'getConfig' | 'listConfig'> {\n return {\n addConfig(this: SimpleGitApi, key: string, value: string, ...rest: unknown[]) {\n return this._runTask(\n addConfigTask(key, value, rest[0] === true, asConfigScope(rest[1], GitConfigScope.local)),\n trailingFunctionArgument(arguments),\n );\n },\n\n getConfig(this: SimpleGitApi, key: string, scope?: GitConfigScope) {\n return this._runTask(\n getConfigTask(key, asConfigScope(scope, undefined)),\n trailingFunctionArgument(arguments),\n )\n },\n\n listConfig(this: SimpleGitApi, ...rest: unknown[]) {\n return this._runTask(\n listConfigTask(asConfigScope(rest[0], undefined)),\n trailingFunctionArgument(arguments),\n );\n },\n };\n}\n", "import { GrepResult, SimpleGit } from '../../../typings';\nimport { SimpleGitApi } from '../simple-git-api';\nimport {\n asNumber,\n forEachLineWithContent,\n getTrailingOptions,\n NULL,\n prefixedArray,\n trailingFunctionArgument\n} from '../utils';\n\nimport { configurationErrorTask } from './task';\n\nconst disallowedOptions = ['-h'];\n\nconst Query = Symbol('grepQuery');\n\nexport interface GitGrepQuery extends Iterable<string> {\n /** Adds one or more terms to be grouped as an \"and\" to any other terms */\n and(...and: string[]): this;\n\n /** Adds one or more search terms - git.grep will \"or\" this to other terms */\n param(...param: string[]): this;\n}\n\nclass GrepQuery implements GitGrepQuery {\n private [Query]: string[] = [];\n\n * [Symbol.iterator]() {\n for (const query of this[Query]) {\n yield query;\n }\n }\n\n and(...and: string[]) {\n and.length && this[Query].push('--and', '(', ...prefixedArray(and, '-e'), ')');\n return this;\n }\n\n param(...param: string[]) {\n this[Query].push(...prefixedArray(param, '-e'));\n return this;\n }\n}\n\n/**\n * Creates a new builder for a `git.grep` query with optional params\n */\nexport function grepQueryBuilder(...params: string[]): GitGrepQuery {\n return new GrepQuery().param(...params);\n}\n\nfunction parseGrep(grep: string): GrepResult {\n const paths: GrepResult['paths'] = new Set<string>();\n const results: GrepResult['results'] = {};\n\n forEachLineWithContent(grep, (input) => {\n const [path, line, preview] = input.split(NULL);\n paths.add(path);\n (results[path] = results[path] || []).push({\n line: asNumber(line),\n path,\n preview,\n });\n });\n\n return {\n paths,\n results,\n };\n}\n\nexport default function (): Pick<SimpleGit, 'grep'> {\n return {\n grep(this: SimpleGitApi, searchTerm: string | GitGrepQuery) {\n const then = trailingFunctionArgument(arguments);\n const options = getTrailingOptions(arguments);\n\n for (const option of disallowedOptions) {\n if (options.includes(option)) {\n return this._runTask(\n configurationErrorTask(`git.grep: use of \"${option}\" is not supported.`),\n then,\n );\n }\n }\n\n if (typeof searchTerm === 'string') {\n searchTerm = grepQueryBuilder().param(searchTerm);\n }\n\n const commands = ['grep', '--null', '-n', '--full-name', ...options, ...searchTerm];\n\n return this._runTask({\n commands,\n format: 'utf-8',\n parser(stdOut) {\n return parseGrep(stdOut);\n },\n }, then);\n }\n }\n}\n", "import { straightThroughStringTask } from './task';\nimport { Maybe, OptionFlags, Options } from '../types';\n\nexport enum ResetMode {\n MIXED = 'mixed',\n SOFT = 'soft',\n HARD = 'hard',\n MERGE = 'merge',\n KEEP = 'keep',\n}\n\nconst ResetModes = Array.from(Object.values(ResetMode));\n\nexport type ResetOptions = Options &\n OptionFlags<'-q' | '--quiet' | '--no-quiet' | '--pathspec-from-nul'> &\n OptionFlags<'--pathspec-from-file', string>;\n\nexport function resetTask(mode: Maybe<ResetMode>, customArgs: string[]) {\n const commands: string[] = ['reset'];\n if (isValidResetMode(mode)) {\n commands.push(`--${mode}`);\n }\n commands.push(...customArgs);\n\n return straightThroughStringTask(commands);\n}\n\nexport function getResetMode(mode: ResetMode | any): Maybe<ResetMode> {\n if (isValidResetMode(mode)) {\n return mode;\n }\n\n switch (typeof mode) {\n case 'string':\n case 'undefined':\n return ResetMode.SOFT;\n }\n\n return;\n}\n\nfunction isValidResetMode(mode: ResetMode | any): mode is ResetMode {\n return ResetModes.includes(mode);\n}\n", "import debug, { Debugger } from 'debug';\nimport { append, filterHasLength, filterString, filterType, NOOP, objectToString, remove } from './utils';\nimport { Maybe } from './types';\n\ndebug.formatters.L = (value: any) => String(filterHasLength(value) ? value.length : '-');\ndebug.formatters.B = (value: Buffer) => {\n if (Buffer.isBuffer(value)) {\n return value.toString('utf8');\n }\n return objectToString(value);\n}\n\ntype OutputLoggingHandler = (message: string, ...args: any[]) => void;\n\nfunction createLog () {\n return debug('simple-git');\n}\n\nexport interface OutputLogger extends OutputLoggingHandler {\n readonly label: string;\n\n info: OutputLoggingHandler;\n step (nextStep?: string): OutputLogger;\n sibling (name: string): OutputLogger;\n}\n\nfunction prefixedLogger (to: Debugger, prefix: string, forward?: OutputLoggingHandler): OutputLoggingHandler {\n if (!prefix || !String(prefix).replace(/\\s*/, '')) {\n return !forward ? to : (message, ...args) => {\n to(message, ...args);\n forward(message, ...args);\n };\n }\n\n return (message, ...args) => {\n to(`%s ${message}`, prefix, ...args);\n if (forward) {\n forward(message, ...args);\n }\n };\n}\n\nfunction childLoggerName (name: Maybe<string>, childDebugger: Maybe<Debugger>, {namespace: parentNamespace}: Debugger): string {\n if (typeof name === 'string') {\n return name;\n }\n const childNamespace = childDebugger && childDebugger.namespace || '';\n\n if (childNamespace.startsWith(parentNamespace)) {\n return childNamespace.substr(parentNamespace.length + 1);\n }\n\n return childNamespace || parentNamespace;\n}\n\nexport function createLogger (label: string, verbose?: string | Debugger, initialStep?: string, infoDebugger = createLog()): OutputLogger {\n const labelPrefix = label && `[${label}]` || '';\n\n const spawned: OutputLogger[] = [];\n const debugDebugger: Maybe<Debugger> = (typeof verbose === 'string') ? infoDebugger.extend(verbose) : verbose;\n const key = childLoggerName(filterType(verbose, filterString), debugDebugger, infoDebugger);\n\n return step(initialStep);\n\n function sibling(name: string, initial?: string) {\n return append(spawned, createLogger(label, key.replace(/^[^:]+/, name), initial, infoDebugger));\n }\n\n function step(phase?: string) {\n const stepPrefix = phase && `[${phase}]` || '';\n const debug = debugDebugger && prefixedLogger(debugDebugger, stepPrefix) || NOOP;\n const info = prefixedLogger(infoDebugger, `${labelPrefix} ${ stepPrefix}`, debug);\n\n return Object.assign(debugDebugger ? debug : info, {\n label,\n sibling,\n info,\n step,\n });\n }\n}\n\n/**\n * The `GitLogger` is used by the main `SimpleGit` runner to handle logging\n * any warnings or errors.\n */\nexport class GitLogger {\n\n public error: OutputLoggingHandler;\n\n public warn: OutputLoggingHandler\n\n constructor(private _out: Debugger = createLog()) {\n this.error = prefixedLogger(_out, '[ERROR]');\n this.warn = prefixedLogger(_out, '[WARN]');\n }\n\n silent (silence = false) {\n if (silence !== this._out.enabled) {\n return;\n }\n\n const {namespace} = this._out;\n const env = (process.env.DEBUG || '').split(',').filter(s => !!s);\n const hasOn = env.includes(namespace);\n const hasOff = env.includes(`-${namespace}`);\n\n // enabling the log\n if (!silence) {\n if (hasOff) {\n remove(env, `-${namespace}`);\n }\n else {\n env.push(namespace);\n }\n }\n else {\n if (hasOn) {\n remove(env, namespace);\n }\n else {\n env.push(`-${namespace}`);\n }\n }\n\n debug.enable(env.join(','));\n }\n\n}\n", "import { SimpleGitTask } from '../types';\nimport { GitError } from '../errors/git-error';\nimport { createLogger, OutputLogger } from '../git-logger';\n\ntype AnySimpleGitTask = SimpleGitTask<any>;\n\ntype TaskInProgress = {\n name: string;\n logger: OutputLogger;\n task: AnySimpleGitTask;\n}\n\nexport class TasksPendingQueue {\n\n private _queue: Map<AnySimpleGitTask, TaskInProgress> = new Map();\n\n constructor(private logLabel = 'GitExecutor') {\n }\n\n private withProgress(task: AnySimpleGitTask) {\n return this._queue.get(task);\n }\n\n private createProgress (task: AnySimpleGitTask): TaskInProgress {\n const name = TasksPendingQueue.getName(task.commands[0]);\n const logger = createLogger(this.logLabel, name);\n\n return {\n task,\n logger,\n name,\n };\n }\n\n push(task: AnySimpleGitTask): TaskInProgress {\n const progress = this.createProgress(task);\n progress.logger('Adding task to the queue, commands = %o', task.commands);\n\n this._queue.set(task, progress);\n\n return progress;\n }\n\n fatal(err: GitError) {\n for (const [task, {logger}] of Array.from(this._queue.entries())) {\n if (task === err.task) {\n logger.info(`Failed %o`, err);\n logger(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`);\n } else {\n logger.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`, err.message);\n }\n\n this.complete(task);\n }\n\n if (this._queue.size !== 0) {\n throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`);\n }\n }\n\n complete(task: AnySimpleGitTask) {\n const progress = this.withProgress(task);\n if (progress) {\n this._queue.delete(task);\n }\n }\n\n attempt(task: AnySimpleGitTask): TaskInProgress {\n const progress = this.withProgress(task);\n if (!progress) {\n throw new GitError(undefined, 'TasksPendingQueue: attempt called for an unknown task');\n }\n progress.logger('Starting task');\n\n return progress;\n }\n\n static getName (name = 'empty') {\n return `task:${name}:${++TasksPendingQueue.counter}`;\n }\n\n private static counter = 0;\n}\n", "import { spawn, SpawnOptions } from 'child_process';\nimport { GitError } from '../errors/git-error';\nimport { OutputLogger } from '../git-logger';\nimport { PluginStore } from '../plugins';\nimport { EmptyTask, isBufferTask, isEmptyTask, } from '../tasks/task';\nimport { GitExecutorResult, Maybe, outputHandler, RunnableTask, SimpleGitExecutor, SimpleGitTask } from '../types';\nimport { callTaskParser, first, GitOutputStreams, objectToString } from '../utils';\nimport { Scheduler } from './scheduler';\nimport { TasksPendingQueue } from './tasks-pending-queue';\n\nexport class GitExecutorChain implements SimpleGitExecutor {\n\n private _chain: Promise<any> = Promise.resolve();\n private _queue = new TasksPendingQueue();\n private _cwd: string | undefined;\n\n public get binary() {\n return this._executor.binary;\n }\n\n public get cwd() {\n return this._cwd || this._executor.cwd;\n }\n\n public set cwd(cwd: string) {\n this._cwd = cwd;\n }\n\n public get env() {\n return this._executor.env;\n }\n\n public get outputHandler() {\n return this._executor.outputHandler;\n }\n\n constructor(\n private _executor: SimpleGitExecutor,\n private _scheduler: Scheduler,\n private _plugins: PluginStore\n ) {\n }\n\n public chain() {\n return this;\n }\n\n public push<R>(task: SimpleGitTask<R>): Promise<R> {\n this._queue.push(task);\n\n return this._chain = this._chain.then(() => this.attemptTask(task));\n }\n\n private async attemptTask<R>(task: SimpleGitTask<R>): Promise<void | R> {\n const onScheduleComplete = await this._scheduler.next();\n const onQueueComplete = () => this._queue.complete(task);\n\n try {\n const {logger} = this._queue.attempt(task);\n return await (isEmptyTask(task)\n ? this.attemptEmptyTask(task, logger)\n : this.attemptRemoteTask(task, logger)\n ) as R;\n } catch (e) {\n throw this.onFatalException(task, e);\n } finally {\n onQueueComplete();\n onScheduleComplete();\n }\n }\n\n private onFatalException<R>(task: SimpleGitTask<R>, e: Error) {\n const gitError = (e instanceof GitError) ? Object.assign(e, {task}) : new GitError(task, e && String(e));\n\n this._chain = Promise.resolve();\n this._queue.fatal(gitError);\n\n return gitError;\n }\n\n private async attemptRemoteTask<R>(task: RunnableTask<R>, logger: OutputLogger) {\n const args = this._plugins.exec('spawn.args', [...task.commands], pluginContext(task, task.commands));\n\n const raw = await this.gitResponse(\n task,\n this.binary, args, this.outputHandler, logger.step('SPAWN'),\n );\n const outputStreams = await this.handleTaskData(task, args, raw, logger.step('HANDLE'));\n\n logger(`passing response to task's parser as a %s`, task.format);\n\n if (isBufferTask(task)) {\n return callTaskParser(task.parser, outputStreams);\n }\n\n return callTaskParser(task.parser, outputStreams.asStrings());\n }\n\n private async attemptEmptyTask(task: EmptyTask, logger: OutputLogger) {\n logger(`empty task bypassing child process to call to task's parser`);\n return task.parser(this);\n }\n\n private handleTaskData<R>(\n task: SimpleGitTask<R>,\n args: string[],\n result: GitExecutorResult, logger: OutputLogger): Promise<GitOutputStreams> {\n\n const {exitCode, rejection, stdOut, stdErr} = result;\n\n return new Promise((done, fail) => {\n logger(`Preparing to handle process response exitCode=%d stdOut=`, exitCode);\n\n const {error} = this._plugins.exec('task.error', {error: rejection}, {\n ...pluginContext(task, args),\n ...result,\n });\n\n if (error && task.onError) {\n logger.info(`exitCode=%s handling with custom error handler`);\n\n return task.onError(\n result,\n error,\n (newStdOut) => {\n logger.info(`custom error handler treated as success`);\n logger(`custom error returned a %s`, objectToString(newStdOut));\n\n done(new GitOutputStreams(\n Array.isArray(newStdOut) ? Buffer.concat(newStdOut) : newStdOut,\n Buffer.concat(stdErr),\n ));\n },\n fail\n );\n }\n\n if (error) {\n logger.info(`handling as error: exitCode=%s stdErr=%s rejection=%o`, exitCode, stdErr.length, rejection);\n return fail(error);\n }\n\n logger.info(`retrieving task output complete`);\n done(new GitOutputStreams(\n Buffer.concat(stdOut),\n Buffer.concat(stdErr),\n ));\n });\n }\n\n private async gitResponse<R>(task: SimpleGitTask<R>, command: string, args: string[], outputHandler: Maybe<outputHandler>, logger: OutputLogger): Promise<GitExecutorResult> {\n const outputLogger = logger.sibling('output');\n const spawnOptions: SpawnOptions = this._plugins.exec('spawn.options', {\n cwd: this.cwd,\n env: this.env,\n windowsHide: true,\n }, pluginContext(task, task.commands));\n\n return new Promise((done) => {\n const stdOut: Buffer[] = [];\n const stdErr: Buffer[] = [];\n\n let rejection: Maybe<Error>;\n\n logger.info(`%s %o`, command, args);\n logger('%O', spawnOptions)\n const spawned = spawn(command, args, spawnOptions);\n\n spawned.stdout!.on('data', onDataReceived(stdOut, 'stdOut', logger, outputLogger.step('stdOut')));\n spawned.stderr!.on('data', onDataReceived(stdErr, 'stdErr', logger, outputLogger.step('stdErr')));\n\n spawned.on('error', onErrorReceived(stdErr, logger));\n\n if (outputHandler) {\n logger(`Passing child process stdOut/stdErr to custom outputHandler`);\n outputHandler(command, spawned.stdout!, spawned.stderr!, [...args]);\n }\n\n this._plugins.exec('spawn.after', undefined, {\n ...pluginContext(task, args),\n spawned,\n close(exitCode: number, reason?: Error) {\n done({\n stdOut,\n stdErr,\n exitCode,\n rejection: rejection || reason,\n });\n },\n kill(reason: Error) {\n if (spawned.killed) {\n return;\n }\n\n rejection = reason;\n spawned.kill('SIGINT');\n },\n });\n });\n }\n\n}\n\nfunction pluginContext<R>(task: SimpleGitTask<R>, commands: string[]) {\n return {\n method: first(task.commands) || '',\n commands,\n }\n}\n\nfunction onErrorReceived(target: Buffer[], logger: OutputLogger) {\n return (err: Error) => {\n logger(`[ERROR] child process exception %o`, err);\n target.push(Buffer.from(String(err.stack), 'ascii'));\n }\n}\n\nfunction onDataReceived(target: Buffer[], name: string, logger: OutputLogger, output: OutputLogger) {\n return (buffer: Buffer) => {\n logger(`%s received %L bytes`, name, buffer);\n output(`%B`, buffer);\n target.push(buffer)\n }\n}\n", "import { PluginStore } from '../plugins';\nimport { GitExecutorEnv, outputHandler, SimpleGitExecutor, SimpleGitTask } from '../types';\n\nimport { GitExecutorChain } from './git-executor-chain';\nimport { Scheduler } from './scheduler';\n\nexport class GitExecutor implements SimpleGitExecutor {\n\n private _chain = new GitExecutorChain(this, this._scheduler, this._plugins);\n\n public env: GitExecutorEnv;\n public outputHandler?: outputHandler;\n\n constructor(\n public binary: string = 'git',\n public cwd: string,\n private _scheduler: Scheduler,\n private _plugins: PluginStore,\n ) {\n }\n\n chain(): SimpleGitExecutor {\n return new GitExecutorChain(this, this._scheduler, this._plugins);\n }\n\n push<R>(task: SimpleGitTask<R>): Promise<R> {\n return this._chain.push(task);\n }\n\n}\n\n\n", "import { GitError } from './errors/git-error';\nimport { GitResponseError } from './errors/git-response-error';\nimport { SimpleGitTask, SimpleGitTaskCallback } from './types';\nimport { NOOP } from './utils';\n\nexport function taskCallback<R>(task: SimpleGitTask<R>, response: Promise<R>, callback: SimpleGitTaskCallback<R> = NOOP) {\n\n const onSuccess = (data: R) => {\n callback(null, data);\n };\n\n const onError = (err: GitError | GitResponseError) => {\n if (err?.task === task) {\n callback((err instanceof GitResponseError) ? addDeprecationNoticeToError(err) : err, undefined as any);\n }\n };\n\n response.then(onSuccess, onError);\n\n}\n\nfunction addDeprecationNoticeToError (err: GitResponseError) {\n let log = (name: string) => {\n console.warn(`simple-git deprecation notice: accessing GitResponseError.${name} should be GitResponseError.git.${name}, this will no longer be available in version 3`);\n log = NOOP;\n };\n\n return Object.create(err, Object.getOwnPropertyNames(err.git).reduce(descriptorReducer, {}));\n\n function descriptorReducer(all: PropertyDescriptorMap, name: string): typeof all {\n if (name in err) {\n return all;\n }\n\n all[name] = {\n enumerable: false,\n configurable: false,\n get () {\n log(name);\n return err.git[name];\n },\n };\n\n return all;\n }\n}\n", "import { folderExists } from '../utils';\nimport { SimpleGitExecutor } from '../types';\nimport { adhocExecTask } from './task';\n\nexport function changeWorkingDirectoryTask (directory: string, root?: SimpleGitExecutor) {\n return adhocExecTask((instance: SimpleGitExecutor) => {\n if (!folderExists(directory)) {\n throw new Error(`Git.cwd: cannot change to non-directory \"${ directory }\"`);\n }\n\n return ((root || instance).cwd = directory);\n });\n}\n", "import { straightThroughStringTask } from './task';\nimport { StringTask } from '../types';\n\n/**\n * Task used by `git.hashObject`\n */\nexport function hashObjectTask(filePath: string, write: boolean): StringTask<string> {\n const commands = ['hash-object', filePath];\n if (write) {\n commands.push('-w');\n }\n\n return straightThroughStringTask(commands, true);\n}\n", "import { InitResult } from '../../../typings';\n\nexport class InitSummary implements InitResult {\n constructor(\n public readonly bare: boolean,\n public readonly path: string,\n public readonly existing: boolean,\n public readonly gitDir: string,\n ) {}\n}\n\nconst initResponseRegex = /^Init.+ repository in (.+)$/;\nconst reInitResponseRegex = /^Rein.+ in (.+)$/;\n\nexport function parseInit(bare: boolean, path: string, text: string) {\n const response = String(text).trim();\n let result;\n\n if ((result = initResponseRegex.exec(response))) {\n return new InitSummary(bare, path, false, result[1]);\n }\n\n if ((result = reInitResponseRegex.exec(response))) {\n return new InitSummary(bare, path, true, result[1]);\n }\n\n let gitDir = '';\n const tokens = response.split(' ');\n while (tokens.length) {\n const token = tokens.shift();\n if (token === 'in') {\n gitDir = tokens.join(' ');\n break;\n }\n }\n\n return new InitSummary(bare, path, /^re/i.test(response), gitDir);\n}\n", "import { InitResult } from '../../../typings';\nimport { parseInit } from '../responses/InitSummary';\nimport { StringTask } from '../types';\n\nconst bareCommand = '--bare';\n\nfunction hasBareCommand(command: string[]) {\n return command.includes(bareCommand);\n}\n\nexport function initTask(bare = false, path: string, customArgs: string[]): StringTask<InitResult> {\n const commands = ['init', ...customArgs];\n if (bare && !hasBareCommand(commands)) {\n commands.splice(1, 0, bareCommand);\n }\n\n return {\n commands,\n format: 'utf-8',\n parser(text: string): InitResult {\n return parseInit(commands.includes('--bare'), path, text);\n }\n }\n}\n", "import { DiffResult, DiffResultBinaryFile, DiffResultTextFile } from '../../../typings';\n\n/***\n * The DiffSummary is returned as a response to getting `git().status()`\n */\nexport class DiffSummary implements DiffResult {\n changed = 0\n deletions = 0;\n insertions = 0;\n\n files: Array<DiffResultTextFile | DiffResultBinaryFile> = [];\n}\n", "import { DiffResult } from '../../../typings';\nimport { DiffSummary } from '../responses/DiffSummary';\n\nexport function parseDiffResult(stdOut: string): DiffResult {\n const lines = stdOut.trim().split('\\n');\n const status = new DiffSummary();\n readSummaryLine(status, lines.pop());\n\n for (let i = 0, max = lines.length; i < max; i++) {\n const line = lines[i];\n textFileChange(line, status) || binaryFileChange(line, status);\n }\n\n return status;\n}\n\nfunction readSummaryLine(status: DiffResult, summary?: string) {\n (summary || '')\n .trim()\n .split(', ')\n .forEach(function (text: string) {\n const summary = /(\\d+)\\s([a-z]+)/.exec(text);\n if (!summary) {\n return;\n }\n\n summaryType(status, summary[2], parseInt(summary[1], 10));\n });\n}\n\nfunction summaryType (status: DiffResult, key: string, value: number) {\n const match = (/([a-z]+?)s?\\b/.exec(key));\n if (!match || !statusUpdate[match[1]]) {\n return;\n }\n\n statusUpdate[match[1]](status, value);\n}\n\nconst statusUpdate: {[key: string]: (status: DiffResult, value: number) => void} = {\n file (status, value) {\n status.changed = value;\n },\n deletion (status, value) {\n status.deletions = value;\n },\n insertion (status, value) {\n status.insertions = value;\n }\n}\n\nfunction textFileChange(input: string, {files}: DiffResult) {\n const line = input.trim().match(/^(.+)\\s+\\|\\s+(\\d+)(\\s+[+\\-]+)?$/);\n\n if (line) {\n var alterations = (line[3] || '').trim();\n files.push({\n file: line[1].trim(),\n changes: parseInt(line[2], 10),\n insertions: alterations.replace(/-/g, '').length,\n deletions: alterations.replace(/\\+/g, '').length,\n binary: false\n });\n\n return true;\n }\n\n return false\n}\n\nfunction binaryFileChange(input: string, {files}: DiffResult) {\n const line = input.match(/^(.+) \\|\\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)$/);\n if (line) {\n files.push({\n file: line[1].trim(),\n before: +line[2],\n after: +line[3],\n binary: true\n });\n return true;\n }\n return false;\n}\n", "import { ListLogLine, LogResult } from '../../../typings';\nimport { toLinesWithContent } from '../utils';\nimport { parseDiffResult } from './parse-diff-summary';\n\nexport const START_BOUNDARY = '\u00F2\u00F2\u00F2\u00F2\u00F2\u00F2 ';\n\nexport const COMMIT_BOUNDARY = ' \u00F2\u00F2';\n\nexport const SPLITTER = ' \u00F2 ';\n\nconst defaultFieldNames = ['hash', 'date', 'message', 'refs', 'author_name', 'author_email'];\n\nfunction lineBuilder(tokens: string[], fields: string[]): any {\n return fields.reduce((line, field, index) => {\n line[field] = tokens[index] || '';\n return line;\n }, Object.create({diff: null}) as any);\n}\n\nexport function createListLogSummaryParser<T = any> (splitter = SPLITTER, fields = defaultFieldNames) {\n return function (stdOut: string): LogResult<T> {\n const all: ReadonlyArray<T & ListLogLine> = toLinesWithContent(stdOut, true, START_BOUNDARY)\n .map(function (item) {\n const lineDetail = item.trim().split(COMMIT_BOUNDARY);\n const listLogLine: T & ListLogLine = lineBuilder(lineDetail[0].trim().split(splitter), fields);\n\n if (lineDetail.length > 1 && !!lineDetail[1].trim()) {\n listLogLine.diff = parseDiffResult(lineDetail[1]);\n }\n\n return listLogLine;\n });\n\n return {\n all,\n latest: all.length && all[0] || null,\n total: all.length,\n };\n }\n}\n", "import { Options, StringTask } from '../types';\nimport { LogResult, SimpleGit } from '../../../typings';\nimport {\n COMMIT_BOUNDARY,\n createListLogSummaryParser,\n SPLITTER,\n START_BOUNDARY\n} from '../parsers/parse-list-log-summary';\nimport {\n appendTaskOptions,\n filterArray,\n filterString,\n filterType,\n trailingFunctionArgument,\n trailingOptionsArgument\n} from '../utils';\nimport { SimpleGitApi } from '../simple-git-api';\nimport { configurationErrorTask } from './task';\n\nenum excludeOptions {\n '--pretty',\n 'max-count',\n 'maxCount',\n 'n',\n 'file',\n 'format',\n 'from',\n 'to',\n 'splitter',\n 'symmetric',\n 'mailMap',\n 'multiLine',\n 'strictDate',\n}\n\nexport interface DefaultLogFields {\n hash: string;\n date: string;\n message: string;\n refs: string;\n body: string;\n author_name: string;\n author_email: string;\n}\n\nexport type LogOptions<T = DefaultLogFields> = {\n file?: string;\n format?: T;\n from?: string;\n mailMap?: boolean;\n maxCount?: number;\n multiLine?: boolean;\n splitter?: string;\n strictDate?: boolean;\n symmetric?: boolean;\n to?: string;\n};\n\ninterface ParsedLogOptions {\n fields: string[];\n splitter: string;\n commands: string[]\n}\n\nfunction prettyFormat(format: { [key: string]: string | unknown }, splitter: string): [string[], string] {\n const fields: string[] = [];\n const formatStr: string[] = [];\n\n Object.keys(format).forEach((field) => {\n fields.push(field);\n formatStr.push(String(format[field]));\n });\n\n return [\n fields, formatStr.join(splitter)\n ];\n}\n\nfunction userOptions<T>(input: T): Exclude<Omit<T, keyof typeof excludeOptions>, undefined> {\n const output = {...input};\n Object.keys(input).forEach(key => {\n if (key in excludeOptions) {\n delete output[key as keyof T];\n }\n });\n return output;\n}\n\nexport function parseLogOptions<T extends Options>(opt: LogOptions<T> = {}, customArgs: string[] = []): ParsedLogOptions {\n const splitter = opt.splitter || SPLITTER;\n const format = opt.format || {\n hash: '%H',\n date: opt.strictDate === false ? '%ai' : '%aI',\n message: '%s',\n refs: '%D',\n body: opt.multiLine ? '%B' : '%b',\n author_name: opt.mailMap !== false ? '%aN' : '%an',\n author_email: opt.mailMap !== false ? '%aE' : '%ae'\n };\n\n const [fields, formatStr] = prettyFormat(format, splitter);\n\n const suffix: string[] = [];\n const command: string[] = [\n `--pretty=format:${START_BOUNDARY}${formatStr}${COMMIT_BOUNDARY}`,\n ...customArgs,\n ];\n\n const maxCount: number | undefined = (opt as any).n || (opt as any)['max-count'] || opt.maxCount;\n if (maxCount) {\n command.push(`--max-count=${maxCount}`);\n }\n\n if (opt.from && opt.to) {\n const rangeOperator = (opt.symmetric !== false) ? '...' : '..';\n suffix.push(`${opt.from}${rangeOperator}${opt.to}`);\n }\n\n if (opt.file) {\n suffix.push('--follow', opt.file);\n }\n\n appendTaskOptions(userOptions(opt), command);\n\n return {\n fields,\n splitter,\n commands: [\n ...command,\n ...suffix,\n ],\n };\n}\n\nexport function logTask<T>(splitter: string, fields: string[], customArgs: string[]): StringTask<LogResult<T>> {\n return {\n commands: ['log', ...customArgs],\n format: 'utf-8',\n parser: createListLogSummaryParser(splitter, fields),\n };\n}\n\nexport default function (): Pick<SimpleGit, 'log'> {\n return {\n log<T extends Options>(this: SimpleGitApi, ...rest: unknown[]) {\n const next = trailingFunctionArgument(arguments);\n const task = rejectDeprecatedSignatures(...rest) ||\n createLogTask(parseLogOptions<T>(trailingOptionsArgument(arguments), filterType(arguments[0], filterArray)))\n\n return this._runTask(task, next);\n }\n }\n\n function createLogTask(options: ParsedLogOptions) {\n return logTask(options.splitter, options.fields, options.commands);\n }\n\n function rejectDeprecatedSignatures(from?: unknown, to?: unknown) {\n return (\n filterString(from) &&\n filterString(to) &&\n configurationErrorTask(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`)\n );\n }\n}\n", "import { MergeConflict, MergeConflictDeletion, MergeDetail, MergeResultStatus } from '../../../typings';\n\nexport class MergeSummaryConflict implements MergeConflict {\n constructor(\n public readonly reason: string,\n public readonly file: string | null = null,\n public readonly meta?: MergeConflictDeletion,\n ) {\n }\n\n toString() {\n return `${this.file}:${this.reason}`;\n }\n}\n\nexport class MergeSummaryDetail implements MergeDetail {\n public conflicts: MergeConflict[] = [];\n public merges: string[] = [];\n public result: MergeResultStatus = 'success';\n\n get failed() {\n return this.conflicts.length > 0;\n }\n\n get reason() {\n return this.result;\n }\n\n toString() {\n if (this.conflicts.length) {\n return `CONFLICTS: ${this.conflicts.join(', ')}`;\n }\n\n return 'OK';\n }\n}\n\n", "import { PullDetailFileChanges, PullDetailSummary, PullFailedResult, PullResult } from '../../../typings';\n\nexport class PullSummary implements PullResult {\n public remoteMessages = {\n all: [],\n };\n public created = [];\n public deleted: string[] = [];\n public files: string[] = [];\n public deletions: PullDetailFileChanges = {};\n public insertions: PullDetailFileChanges = {};\n public summary: PullDetailSummary = {\n changes: 0,\n deletions: 0,\n insertions: 0,\n };\n}\n\nexport class PullFailedSummary implements PullFailedResult {\n remote = '';\n hash = {\n local: '',\n remote: '',\n };\n branch = {\n local: '',\n remote: '',\n };\n message = '';\n\n toString() {\n return this.message;\n }\n}\n\n", "import { RemoteMessageResult, RemoteMessages, RemoteMessagesObjectEnumeration } from '../../../typings';\nimport { asNumber, RemoteLineParser } from '../utils';\n\nfunction objectEnumerationResult<T extends RemoteMessages = RemoteMessages>(remoteMessages: T): RemoteMessagesObjectEnumeration {\n return (remoteMessages.objects = remoteMessages.objects || {\n compressing: 0,\n counting: 0,\n enumerating: 0,\n packReused: 0,\n reused: {count: 0, delta: 0},\n total: {count: 0, delta: 0}\n });\n}\n\nfunction asObjectCount(source: string) {\n const count = /^\\s*(\\d+)/.exec(source);\n const delta = /delta (\\d+)/i.exec(source);\n\n return {\n count: asNumber(count && count[1] || '0'),\n delta: asNumber(delta && delta[1] || '0'),\n };\n}\n\nexport const remoteMessagesObjectParsers: RemoteLineParser<RemoteMessageResult<RemoteMessages>>[] = [\n new RemoteLineParser(/^remote:\\s*(enumerating|counting|compressing) objects: (\\d+),/i, (result, [action, count]) => {\n const key = action.toLowerCase();\n const enumeration = objectEnumerationResult(result.remoteMessages);\n\n Object.assign(enumeration, {[key]: asNumber(count)});\n }),\n new RemoteLineParser(/^remote:\\s*(enumerating|counting|compressing) objects: \\d+% \\(\\d+\\/(\\d+)\\),/i, (result, [action, count]) => {\n const key = action.toLowerCase();\n const enumeration = objectEnumerationResult(result.remoteMessages);\n\n Object.assign(enumeration, {[key]: asNumber(count)});\n }),\n new RemoteLineParser(/total ([^,]+), reused ([^,]+), pack-reused (\\d+)/i, (result, [total, reused, packReused]) => {\n const objects = objectEnumerationResult(result.remoteMessages);\n objects.total = asObjectCount(total);\n objects.reused = asObjectCount(reused);\n objects.packReused = asNumber(packReused);\n }),\n];\n", "import { PushResultRemoteMessages, RemoteMessageResult, RemoteMessages } from '../../../typings';\nimport { asNumber, parseStringResponse, RemoteLineParser } from '../utils';\nimport { remoteMessagesObjectParsers } from './parse-remote-objects';\n\nconst parsers: RemoteLineParser<RemoteMessageResult<PushResultRemoteMessages | RemoteMessages>>[] = [\n new RemoteLineParser(/^remote:\\s*(.+)$/, (result, [text]) => {\n result.remoteMessages.all.push(text.trim());\n return false;\n }),\n ...remoteMessagesObjectParsers,\n new RemoteLineParser([/create a (?:pull|merge) request/i, /\\s(https?:\\/\\/\\S+)$/], (result, [pullRequestUrl]) => {\n (result.remoteMessages as PushResultRemoteMessages).pullRequestUrl = pullRequestUrl;\n }),\n new RemoteLineParser([/found (\\d+) vulnerabilities.+\\(([^)]+)\\)/i, /\\s(https?:\\/\\/\\S+)$/], (result, [count, summary, url]) => {\n (result.remoteMessages as PushResultRemoteMessages).vulnerabilities = {\n count: asNumber(count),\n summary,\n url,\n };\n }),\n];\n\nexport function parseRemoteMessages<T extends RemoteMessages = RemoteMessages>(\n _stdOut: string, stdErr: string,\n): RemoteMessageResult {\n return parseStringResponse({remoteMessages: new RemoteMessageSummary() as T}, parsers, stdErr);\n}\n\nexport class RemoteMessageSummary implements RemoteMessages {\n public readonly all: string[] = [];\n}\n", "import { PullDetail, PullFailedResult, PullResult, RemoteMessages } from '../../../typings';\nimport { PullFailedSummary, PullSummary } from '../responses/PullSummary';\nimport { TaskParser } from '../types';\nimport { append, LineParser, parseStringResponse } from '../utils';\nimport { parseRemoteMessages } from './parse-remote-messages';\n\nconst FILE_UPDATE_REGEX = /^\\s*(.+?)\\s+\\|\\s+\\d+\\s*(\\+*)(-*)/;\nconst SUMMARY_REGEX = /(\\d+)\\D+((\\d+)\\D+\\(\\+\\))?(\\D+(\\d+)\\D+\\(-\\))?/;\nconst ACTION_REGEX = /^(create|delete) mode \\d+ (.+)/;\n\nconst parsers: LineParser<PullResult>[] = [\n new LineParser(FILE_UPDATE_REGEX, (result, [file, insertions, deletions]) => {\n result.files.push(file);\n\n if (insertions) {\n result.insertions[file] = insertions.length;\n }\n\n if (deletions) {\n result.deletions[file] = deletions.length;\n }\n }),\n new LineParser(SUMMARY_REGEX, (result, [changes, , insertions, , deletions]) => {\n if (insertions !== undefined || deletions !== undefined) {\n result.summary.changes = +changes || 0;\n result.summary.insertions = +insertions || 0;\n result.summary.deletions = +deletions || 0;\n return true;\n }\n return false;\n }),\n new LineParser(ACTION_REGEX, (result, [action, file]) => {\n append(result.files, file);\n append((action === 'create') ? result.created : result.deleted, file);\n }),\n];\n\nconst errorParsers: LineParser<PullFailedResult>[] = [\n new LineParser(/^from\\s(.+)$/i, (result, [remote]) => void (result.remote = remote)),\n new LineParser(/^fatal:\\s(.+)$/, (result, [message]) => void (result.message = message)),\n new LineParser(/([a-z0-9]+)\\.\\.([a-z0-9]+)\\s+(\\S+)\\s+->\\s+(\\S+)$/, (result, [hashLocal, hashRemote, branchLocal, branchRemote]) => {\n result.branch.local = branchLocal;\n result.hash.local = hashLocal;\n result.branch.remote = branchRemote;\n result.hash.remote = hashRemote;\n }),\n];\n\nexport const parsePullDetail: TaskParser<string, PullDetail> = (stdOut, stdErr) => {\n return parseStringResponse(new PullSummary(), parsers, stdOut, stdErr);\n}\n\nexport const parsePullResult: TaskParser<string, PullResult> = (stdOut, stdErr) => {\n return Object.assign(\n new PullSummary(),\n parsePullDetail(stdOut, stdErr),\n parseRemoteMessages<RemoteMessages>(stdOut, stdErr),\n );\n}\n\nexport function parsePullErrorResult(stdOut: string, stdErr: string) {\n const pullError = parseStringResponse(new PullFailedSummary(), errorParsers, stdOut, stdErr);\n\n return pullError.message && pullError;\n}\n", "import { MergeDetail, MergeResult } from '../../../typings';\nimport { MergeSummaryConflict, MergeSummaryDetail } from '../responses/MergeSummary';\nimport { TaskParser } from '../types';\nimport { LineParser, parseStringResponse } from '../utils';\nimport { parsePullResult } from './parse-pull';\n\nconst parsers: LineParser<MergeDetail>[] = [\n new LineParser(/^Auto-merging\\s+(.+)$/, (summary, [autoMerge]) => {\n summary.merges.push(autoMerge);\n }),\n new LineParser(/^CONFLICT\\s+\\((.+)\\): Merge conflict in (.+)$/, (summary, [reason, file]) => {\n summary.conflicts.push(new MergeSummaryConflict(reason, file));\n }),\n new LineParser(/^CONFLICT\\s+\\((.+\\/delete)\\): (.+) deleted in (.+) and/, (summary, [reason, file, deleteRef]) => {\n summary.conflicts.push(new MergeSummaryConflict(reason, file, {deleteRef}));\n }),\n new LineParser(/^CONFLICT\\s+\\((.+)\\):/, (summary, [reason]) => {\n summary.conflicts.push(new MergeSummaryConflict(reason, null));\n }),\n new LineParser(/^Automatic merge failed;\\s+(.+)$/, (summary, [result]) => {\n summary.result = result;\n }),\n];\n\n/**\n * Parse the complete response from `git.merge`\n */\nexport const parseMergeResult: TaskParser<string, MergeResult> = (stdOut, stdErr) => {\n return Object.assign(\n parseMergeDetail(stdOut, stdErr),\n parsePullResult(stdOut, stdErr),\n );\n};\n\n/**\n * Parse the merge specific detail (ie: not the content also available in the pull detail) from `git.mnerge`\n * @param stdOut\n */\nexport const parseMergeDetail: TaskParser<string, MergeDetail> = (stdOut) => {\n return parseStringResponse(new MergeSummaryDetail(), parsers, stdOut);\n}\n", "import { MergeResult } from '../../../typings';\nimport { GitResponseError } from '../errors/git-response-error';\nimport { parseMergeResult } from '../parsers/parse-merge';\nimport { StringTask } from '../types';\nimport { configurationErrorTask, EmptyTask } from './task';\n\nexport function mergeTask(customArgs: string[]): EmptyTask | StringTask<MergeResult> {\n if (!customArgs.length) {\n return configurationErrorTask('Git.merge requires at least one option');\n }\n\n return {\n commands: ['merge', ...customArgs],\n format: 'utf-8',\n parser(stdOut, stdErr): MergeResult {\n const merge = parseMergeResult(stdOut, stdErr);\n if (merge.failed) {\n throw new GitResponseError(merge);\n }\n\n return merge;\n }\n }\n}\n", "import { PushDetail, PushResult, PushResultPushedItem, PushResultRemoteMessages } from '../../../typings';\nimport { TaskParser } from '../types';\nimport { LineParser, parseStringResponse } from '../utils';\nimport { parseRemoteMessages } from './parse-remote-messages';\n\nfunction pushResultPushedItem(local: string, remote: string, status: string): PushResultPushedItem {\n const deleted = status.includes('deleted');\n const tag = status.includes('tag') || /^refs\\/tags/.test(local);\n const alreadyUpdated = !status.includes('new');\n\n return {\n deleted,\n tag,\n branch: !tag,\n new: !alreadyUpdated,\n alreadyUpdated,\n local,\n remote,\n };\n}\n\nconst parsers: LineParser<PushDetail>[] = [\n new LineParser(/^Pushing to (.+)$/, (result, [repo]) => {\n result.repo = repo;\n }),\n new LineParser(/^updating local tracking ref '(.+)'/, (result, [local]) => {\n result.ref = {\n ...(result.ref || {}),\n local,\n }\n }),\n new LineParser(/^[*-=]\\s+([^:]+):(\\S+)\\s+\\[(.+)]$/, (result, [local, remote, type]) => {\n result.pushed.push(pushResultPushedItem(local, remote, type));\n }),\n new LineParser(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/, (result, [local, remote, remoteName]) => {\n result.branch = {\n ...(result.branch || {}),\n local,\n remote,\n remoteName,\n };\n }),\n new LineParser(/^([^:]+):(\\S+)\\s+([a-z0-9]+)\\.\\.([a-z0-9]+)$/, (result, [local, remote, from, to]) => {\n result.update = {\n head: {\n local,\n remote,\n },\n hash: {\n from,\n to,\n },\n };\n }),\n];\n\nexport const parsePushResult: TaskParser<string, PushResult> = (stdOut, stdErr) => {\n const pushDetail = parsePushDetail(stdOut, stdErr);\n const responseDetail = parseRemoteMessages<PushResultRemoteMessages>(stdOut, stdErr);\n\n return {\n ...pushDetail,\n ...responseDetail,\n };\n}\n\nexport const parsePushDetail: TaskParser<string, PushDetail> = (stdOut, stdErr) => {\n return parseStringResponse({pushed: []}, parsers, stdOut, stdErr);\n}\n", "import { PushResult } from '../../../typings';\nimport { parsePushResult as parser } from '../parsers/parse-push';\nimport { StringTask } from '../types';\nimport { append, remove } from '../utils';\n\ntype PushRef = { remote?: string, branch?: string };\n\nexport function pushTagsTask(ref: PushRef = {}, customArgs: string[]): StringTask<PushResult> {\n append(customArgs, '--tags');\n return pushTask(ref, customArgs);\n}\n\nexport function pushTask(ref: PushRef = {}, customArgs: string[]): StringTask<PushResult> {\n const commands = ['push', ...customArgs];\n if (ref.branch) {\n commands.splice(1, 0, ref.branch);\n }\n if (ref.remote) {\n commands.splice(1, 0, ref.remote);\n }\n\n remove(commands, '-v');\n append(commands, '--verbose');\n append(commands, '--porcelain');\n\n return {\n commands,\n format: 'utf-8',\n parser,\n };\n}\n", "import { FileStatusResult } from '../../../typings/response';\n\nexport const fromPathRegex = /^(.+) -> (.+)$/;\n\nexport class FileStatusSummary implements FileStatusResult {\n\n public readonly from: string | undefined;\n\n constructor (\n public path: string,\n public index: string,\n public working_dir: string) {\n\n if ('R' === (index + working_dir)) {\n const detail = fromPathRegex.exec(path) || [null, path, path];\n this.from = detail[1] || '';\n this.path = detail[2] || '';\n }\n }\n}\n", "import { StatusResult } from '../../../typings';\nimport { append } from '../utils';\nimport { FileStatusSummary } from './FileStatusSummary';\n\ntype StatusLineParser = (result: StatusResult, file: string) => void;\n\nexport class StatusSummary implements StatusResult {\n public not_added = [];\n public conflicted = [];\n public created = [];\n public deleted = [];\n public ignored = undefined;\n public modified = [];\n public renamed = [];\n public files = [];\n public staged = [];\n public ahead = 0;\n public behind = 0;\n public current = null;\n public tracking = null;\n public detached = false;\n\n public isClean(): boolean {\n return !this.files.length;\n }\n}\n\nenum PorcelainFileStatus {\n ADDED = 'A',\n DELETED = 'D',\n MODIFIED = 'M',\n RENAMED = 'R',\n COPIED = 'C',\n UNMERGED = 'U',\n UNTRACKED = '?',\n IGNORED = '!',\n NONE = ' ',\n}\n\nfunction renamedFile(line: string) {\n const detail = /^(.+) -> (.+)$/.exec(line);\n\n if (!detail) {\n return {\n from: line, to: line\n };\n }\n\n return {\n from: String(detail[1]),\n to: String(detail[2]),\n };\n}\n\nfunction parser(indexX: PorcelainFileStatus, indexY: PorcelainFileStatus, handler: StatusLineParser): [string, StatusLineParser] {\n return [`${indexX}${indexY}`, handler];\n}\n\nfunction conflicts(indexX: PorcelainFileStatus, ...indexY: PorcelainFileStatus[]) {\n return indexY.map(y => parser(indexX, y, (result, file) => append(result.conflicted, file)));\n}\n\nconst parsers: Map<string, StatusLineParser> = new Map([\n parser(PorcelainFileStatus.NONE, PorcelainFileStatus.ADDED, (result, file) => append(result.created, file)),\n parser(PorcelainFileStatus.NONE, PorcelainFileStatus.DELETED, (result, file) => append(result.deleted, file)),\n parser(PorcelainFileStatus.NONE, PorcelainFileStatus.MODIFIED, (result, file) => append(result.modified, file)),\n\n parser(PorcelainFileStatus.ADDED, PorcelainFileStatus.NONE, (result, file) => append(result.created, file) && append(result.staged, file)),\n parser(PorcelainFileStatus.ADDED, PorcelainFileStatus.MODIFIED, (result, file) =>\n append(result.created, file) && append(result.staged, file) && append(result.modified, file)),\n\n parser(PorcelainFileStatus.DELETED, PorcelainFileStatus.NONE, (result, file) => append(result.deleted, file) && append(result.staged, file)),\n\n parser(PorcelainFileStatus.MODIFIED, PorcelainFileStatus.NONE, (result, file) => append(result.modified, file) && append(result.staged, file)),\n parser(PorcelainFileStatus.MODIFIED, PorcelainFileStatus.MODIFIED, (result, file) => append(result.modified, file) && append(result.staged, file)),\n\n parser(PorcelainFileStatus.RENAMED, PorcelainFileStatus.NONE, (result, file) => {\n append(result.renamed, renamedFile(file));\n }),\n parser(PorcelainFileStatus.RENAMED, PorcelainFileStatus.MODIFIED, (result, file) => {\n const renamed = renamedFile(file);\n append(result.renamed, renamed);\n append(result.modified, renamed.to);\n }),\n parser(PorcelainFileStatus.IGNORED, PorcelainFileStatus.IGNORED, (_result, _file) => {\n append((_result.ignored = _result.ignored || []), _file);\n }),\n\n parser(PorcelainFileStatus.UNTRACKED, PorcelainFileStatus.UNTRACKED, (result, file) => append(result.not_added, file)),\n\n ...conflicts(PorcelainFileStatus.ADDED, PorcelainFileStatus.ADDED, PorcelainFileStatus.UNMERGED),\n ...conflicts(PorcelainFileStatus.DELETED, PorcelainFileStatus.DELETED, PorcelainFileStatus.UNMERGED),\n ...conflicts(PorcelainFileStatus.UNMERGED, PorcelainFileStatus.ADDED, PorcelainFileStatus.DELETED, PorcelainFileStatus.UNMERGED),\n\n ['##', (result, line) => {\n const aheadReg = /ahead (\\d+)/;\n const behindReg = /behind (\\d+)/;\n const currentReg = /^(.+?(?=(?:\\.{3}|\\s|$)))/;\n const trackingReg = /\\.{3}(\\S*)/;\n const onEmptyBranchReg = /\\son\\s([\\S]+)$/;\n let regexResult;\n\n regexResult = aheadReg.exec(line);\n result.ahead = regexResult && +regexResult[1] || 0;\n\n regexResult = behindReg.exec(line);\n result.behind = regexResult && +regexResult[1] || 0;\n\n regexResult = currentReg.exec(line);\n result.current = regexResult && regexResult[1];\n\n regexResult = trackingReg.exec(line);\n result.tracking = regexResult && regexResult[1];\n\n regexResult = onEmptyBranchReg.exec(line);\n result.current = regexResult && regexResult[1] || result.current;\n\n result.detached = /\\(no branch\\)/.test(line);\n }]\n]);\n\nexport const parseStatusSummary = function (text: string): StatusResult {\n const lines = text.trim().split('\\n');\n const status = new StatusSummary();\n\n for (let i = 0, l = lines.length; i < l; i++) {\n splitLine(status, lines[i]);\n }\n\n return status;\n};\n\nfunction splitLine(result: StatusResult, lineStr: string) {\n const trimmed = lineStr.trim();\n switch (' ') {\n case trimmed.charAt(2):\n return data(trimmed.charAt(0), trimmed.charAt(1), trimmed.substr(3));\n case trimmed.charAt(1):\n return data(PorcelainFileStatus.NONE, trimmed.charAt(0), trimmed.substr(2));\n default:\n return;\n }\n\n function data(index: string, workingDir: string, path: string) {\n const raw = `${index}${workingDir}`;\n const handler = parsers.get(raw);\n\n if (handler) {\n handler(result, path);\n }\n\n if (raw !== '##' && raw !== '!!') {\n result.files.push(new FileStatusSummary(path, index, workingDir));\n }\n }\n}\n", "import { StatusResult } from '../../../typings';\nimport { parseStatusSummary } from '../responses/StatusSummary';\nimport { StringTask } from '../types';\n\nexport function statusTask(customArgs: string[]): StringTask<StatusResult> {\n return {\n format: 'utf-8',\n commands: ['status', '--porcelain', '-b', '-u', ...customArgs],\n parser(text: string) {\n return parseStatusSummary(text);\n }\n }\n}\n", "import { SimpleGitBase } from '../../typings';\nimport { taskCallback } from './task-callback';\nimport { changeWorkingDirectoryTask } from './tasks/change-working-directory';\nimport config from './tasks/config';\nimport grep from './tasks/grep';\nimport { hashObjectTask } from './tasks/hash-object';\nimport { initTask } from './tasks/init';\nimport log from './tasks/log';\nimport { mergeTask } from './tasks/merge';\nimport { pushTask } from './tasks/push';\nimport { statusTask } from './tasks/status';\nimport { configurationErrorTask, straightThroughStringTask } from './tasks/task';\nimport { outputHandler, SimpleGitExecutor, SimpleGitTask, SimpleGitTaskCallback } from './types';\nimport { asArray, filterString, filterType, getTrailingOptions, trailingFunctionArgument } from './utils';\n\nexport class SimpleGitApi implements SimpleGitBase {\n\n constructor(private _executor: SimpleGitExecutor) {\n }\n\n protected _runTask<T>(task: SimpleGitTask<T>, then?: SimpleGitTaskCallback<T>) {\n const chain = this._executor.chain();\n const promise = chain.push(task);\n\n if (then) {\n taskCallback(task, promise, then);\n }\n\n return Object.create(this, {\n then: {value: promise.then.bind(promise)},\n catch: {value: promise.catch.bind(promise)},\n _executor: {value: chain},\n });\n }\n\n add(files: string | string[]) {\n return this._runTask(\n straightThroughStringTask(['add', ...asArray(files)]),\n trailingFunctionArgument(arguments),\n );\n }\n\n cwd(directory: string | { path: string, root?: boolean }) {\n const next = trailingFunctionArgument(arguments);\n\n if (typeof directory === 'string') {\n return this._runTask(changeWorkingDirectoryTask(directory, this._executor), next);\n }\n\n if (typeof directory?.path === 'string') {\n return this._runTask(changeWorkingDirectoryTask(directory.path, directory.root && this._executor || undefined), next);\n }\n\n return this._runTask(\n configurationErrorTask('Git.cwd: workingDirectory must be supplied as a string'),\n next\n );\n }\n\n hashObject(path: string, write: boolean | unknown) {\n return this._runTask(\n hashObjectTask(path, write === true),\n trailingFunctionArgument(arguments),\n );\n }\n\n init(bare?: boolean | unknown) {\n return this._runTask(\n initTask(bare === true, this._executor.cwd, getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments),\n );\n }\n\n merge() {\n return this._runTask(\n mergeTask(getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments),\n );\n }\n\n mergeFromTo(remote: string, branch: string) {\n if (!(filterString(remote) && filterString(branch))) {\n return this._runTask(configurationErrorTask(\n `Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`\n ));\n }\n\n return this._runTask(\n mergeTask([remote, branch, ...getTrailingOptions(arguments)]),\n trailingFunctionArgument(arguments, false),\n );\n }\n\n outputHandler(handler: outputHandler) {\n this._executor.outputHandler = handler;\n return this;\n }\n\n push() {\n const task = pushTask(\n {\n remote: filterType(arguments[0], filterString),\n branch: filterType(arguments[1], filterString),\n },\n getTrailingOptions(arguments),\n );\n\n return this._runTask(\n task,\n trailingFunctionArgument(arguments),\n );\n }\n\n stash() {\n return this._runTask(\n straightThroughStringTask(['stash', ...getTrailingOptions(arguments)]),\n trailingFunctionArgument(arguments),\n );\n }\n\n status() {\n return this._runTask(statusTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments));\n }\n}\n\nObject.assign(SimpleGitApi.prototype, config(), grep(), log());\n", "import { append, remove } from '../utils';\nimport { createDeferred, DeferredPromise } from '@kwsites/promise-deferred';\nimport { createLogger } from '../git-logger';\n\ntype ScheduleCompleteCallback = () => void;\ntype ScheduledTask = Pick<DeferredPromise<ScheduleCompleteCallback>, 'promise' | 'done'> & {id: number};\n\nconst createScheduledTask: () => ScheduledTask = (() => {\n let id = 0;\n return () => {\n id++;\n const {promise, done} = createDeferred<ScheduleCompleteCallback>();\n\n return {\n promise,\n done,\n id,\n };\n }\n})();\n\nexport class Scheduler {\n private logger = createLogger('', 'scheduler');\n private pending: ScheduledTask[] = [];\n private running: ScheduledTask[] = [];\n\n constructor(private concurrency = 2) {\n this.logger(`Constructed, concurrency=%s`, concurrency);\n }\n\n private schedule() {\n if (!this.pending.length || this.running.length >= this.concurrency) {\n this.logger(`Schedule attempt ignored, pending=%s running=%s concurrency=%s`, this.pending.length, this.running.length, this.concurrency);\n return;\n }\n\n const task = append(this.running, this.pending.shift()!);\n this.logger(`Attempting id=%s`, task.id);\n task.done(() => {\n this.logger(`Completing id=`, task.id);\n remove(this.running, task);\n this.schedule();\n });\n }\n\n next(): Promise<ScheduleCompleteCallback> {\n const {promise, id} = append(this.pending, createScheduledTask());\n this.logger(`Scheduling id=%s`, id);\n\n this.schedule();\n\n return promise;\n }\n}\n", "import { straightThroughStringTask } from './task';\nimport { OptionFlags, Options, StringTask } from '../types';\n\nexport type ApplyOptions = Options &\n OptionFlags<\n | '--stat'\n | '--numstat'\n | '--summary'\n | '--check'\n | '--index'\n | '--intent-to-add'\n | '--3way'\n | '--apply'\n | '--no-add'\n | '-R'\n | '--reverse'\n | '--allow-binary-replacement'\n | '--binary'\n | '--reject'\n | '-z'\n | '--inaccurate-eof'\n | '--recount'\n | '--cached'\n | '--ignore-space-change'\n | '--ignore-whitespace'\n | '--verbose'\n | '--unsafe-paths'> &\n OptionFlags<\n '--whitespace',\n 'nowarn' | 'warn' | 'fix' | 'error' | 'error-all'> &\n OptionFlags<'--build-fake-ancestor' | '--exclude' | '--include' | '--directory',\n string> &\n OptionFlags<'-p' | '-C', number>;\n\nexport function applyPatchTask(patches: string[], customArgs: string[]): StringTask<string> {\n return straightThroughStringTask(['apply', ...customArgs, ...patches]);\n}\n", "import {\n BranchMultiDeleteResult,\n BranchSingleDeleteFailure,\n BranchSingleDeleteResult,\n BranchSingleDeleteSuccess\n} from '../../../typings';\n\nexport class BranchDeletionBatch implements BranchMultiDeleteResult {\n all: BranchSingleDeleteResult[] = [];\n branches: { [branchName: string]: BranchSingleDeleteResult } = {};\n errors: BranchSingleDeleteResult[] = [];\n\n get success(): boolean {\n return !this.errors.length;\n }\n}\n\nexport function branchDeletionSuccess (branch: string, hash: string): BranchSingleDeleteSuccess {\n return {\n branch, hash, success: true,\n };\n}\n\nexport function branchDeletionFailure (branch: string): BranchSingleDeleteFailure {\n return {\n branch, hash: null, success: false,\n };\n}\n\nexport function isSingleBranchDeleteFailure (test: BranchSingleDeleteResult): test is BranchSingleDeleteSuccess {\n return test.success;\n}\n", "import { BranchMultiDeleteResult } from '../../../typings';\nimport { BranchDeletionBatch, branchDeletionFailure, branchDeletionSuccess } from '../responses/BranchDeleteSummary';\nimport { TaskParser } from '../types';\nimport { ExitCodes, LineParser, parseStringResponse } from '../utils';\n\nconst deleteSuccessRegex = /(\\S+)\\s+\\(\\S+\\s([^)]+)\\)/;\nconst deleteErrorRegex = /^error[^']+'([^']+)'/m;\n\nconst parsers: LineParser<BranchMultiDeleteResult>[] = [\n new LineParser(deleteSuccessRegex, (result, [branch, hash]) => {\n const deletion = branchDeletionSuccess(branch, hash);\n\n result.all.push(deletion);\n result.branches[branch] = deletion;\n }),\n new LineParser(deleteErrorRegex, (result, [branch]) => {\n const deletion = branchDeletionFailure(branch);\n\n result.errors.push(deletion);\n result.all.push(deletion);\n result.branches[branch] = deletion;\n }),\n];\n\nexport const parseBranchDeletions: TaskParser<string, BranchMultiDeleteResult> = (stdOut, stdErr) => {\n return parseStringResponse(new BranchDeletionBatch(), parsers, stdOut, stdErr);\n}\n\nexport function hasBranchDeletionError(data: string, processExitCode: ExitCodes): boolean {\n return processExitCode === ExitCodes.ERROR && deleteErrorRegex.test(data);\n}\n", "import { BranchSummary, BranchSummaryBranch } from '../../../typings';\n\nexport class BranchSummaryResult implements BranchSummary {\n public all: string[] = [];\n public branches: { [p: string]: BranchSummaryBranch } = {};\n public current: string = '';\n public detached: boolean = false;\n\n push(current: boolean, detached: boolean, name: string, commit: string, label: string) {\n if (current) {\n this.detached = detached;\n this.current = name;\n }\n\n this.all.push(name);\n this.branches[name] = {\n current: current,\n name: name,\n commit: commit,\n label: label\n };\n }\n}\n\n", "import { BranchSummary } from '../../../typings';\nimport { BranchSummaryResult } from '../responses/BranchSummary';\nimport { LineParser, parseStringResponse } from '../utils';\n\nconst parsers: LineParser<BranchSummaryResult>[] = [\n new LineParser(/^(\\*\\s)?\\((?:HEAD )?detached (?:from|at) (\\S+)\\)\\s+([a-z0-9]+)\\s(.*)$/, (result, [current, name, commit, label]) => {\n result.push(\n !!current,\n true,\n name, commit, label\n );\n }),\n new LineParser(/^(\\*\\s)?(\\S+)\\s+([a-z0-9]+)\\s?(.*)$/s, (result, [current, name, commit, label]) => {\n result.push(\n !!current,\n false,\n name, commit, label\n );\n })\n];\n\nexport function parseBranchSummary (stdOut: string): BranchSummary {\n return parseStringResponse(new BranchSummaryResult(), parsers, stdOut);\n}\n", "import { BranchMultiDeleteResult, BranchSingleDeleteResult, BranchSummary } from '../../../typings';\nimport { StringTask } from '../types';\nimport { GitResponseError } from '../errors/git-response-error';\nimport { hasBranchDeletionError, parseBranchDeletions } from '../parsers/parse-branch-delete';\nimport { parseBranchSummary } from '../parsers/parse-branch';\nimport { bufferToString } from '../utils';\n\nexport function containsDeleteBranchCommand(commands: string[]) {\n const deleteCommands = ['-d', '-D', '--delete'];\n return commands.some(command => deleteCommands.includes(command));\n}\n\nexport function branchTask(customArgs: string[]): StringTask<BranchSummary | BranchSingleDeleteResult> {\n const isDelete = containsDeleteBranchCommand(customArgs);\n const commands = ['branch', ...customArgs];\n\n if (commands.length === 1) {\n commands.push('-a');\n }\n\n if (!commands.includes('-v')) {\n commands.splice(1, 0, '-v');\n }\n\n return {\n format: 'utf-8',\n commands,\n parser(stdOut, stdErr) {\n if (isDelete) {\n return parseBranchDeletions(stdOut, stdErr).all[0];\n }\n\n return parseBranchSummary(stdOut);\n },\n }\n}\n\nexport function branchLocalTask(): StringTask<BranchSummary> {\n const parser = parseBranchSummary;\n\n return {\n format: 'utf-8',\n commands: ['branch', '-v'],\n parser,\n }\n}\n\nexport function deleteBranchesTask(branches: string[], forceDelete = false): StringTask<BranchMultiDeleteResult> {\n return {\n format: 'utf-8',\n commands: ['branch', '-v', forceDelete ? '-D' : '-d', ...branches],\n parser(stdOut, stdErr) {\n return parseBranchDeletions(stdOut, stdErr);\n },\n onError({exitCode, stdOut}, error, done, fail) {\n if (!hasBranchDeletionError(String(error), exitCode)) {\n return fail(error);\n }\n\n done(stdOut);\n },\n }\n}\n\nexport function deleteBranchTask(branch: string, forceDelete = false): StringTask<BranchSingleDeleteResult> {\n const task: StringTask<BranchSingleDeleteResult> = {\n format: 'utf-8',\n commands: ['branch', '-v', forceDelete ? '-D' : '-d', branch],\n parser(stdOut, stdErr) {\n return parseBranchDeletions(stdOut, stdErr).branches[branch]!;\n },\n onError({exitCode, stdErr, stdOut}, error, _, fail) {\n if (!hasBranchDeletionError(String(error), exitCode)) {\n return fail(error);\n }\n\n throw new GitResponseError(\n task.parser(bufferToString(stdOut), bufferToString(stdErr)),\n String(error)\n );\n },\n };\n\n return task;\n}\n", "\n/**\n * Parser for the `check-ignore` command - returns each file as a string array\n */\nexport const parseCheckIgnore = (text: string): string[] => {\n return text.split(/\\n/g)\n .map(line => line.trim())\n .filter(file => !!file);\n};\n", "import { StringTask } from '../types';\nimport { parseCheckIgnore } from '../responses/CheckIgnore';\n\nexport function checkIgnoreTask(paths: string[]): StringTask<string[]> {\n return {\n commands: ['check-ignore', ...paths],\n format: 'utf-8',\n parser: parseCheckIgnore,\n };\n}\n", "import { straightThroughStringTask } from './task';\nimport { OptionFlags, Options, StringTask } from '../types';\nimport { append } from '../utils';\n\nexport type CloneOptions = Options &\n OptionFlags<\n '--bare' |\n '--dissociate' |\n '--mirror' |\n '--no-checkout' |\n '--no-remote-submodules' |\n '--no-shallow-submodules' |\n '--no-single-branch' |\n '--no-tags' |\n '--remote-submodules' |\n '--single-branch' |\n '--shallow-submodules' |\n '--verbose'\n > &\n OptionFlags<'--depth' | '-j' | '--jobs', number> &\n OptionFlags<'--branch' | '--origin' | '--recurse-submodules' | '--separate-git-dir' | '--shallow-exclude' | '--shallow-since' | '--template', string>\n\nexport function cloneTask(repo: string | undefined, directory: string | undefined, customArgs: string[]): StringTask<string> {\n const commands = ['clone', ...customArgs];\n if (typeof repo === 'string') {\n commands.push(repo);\n }\n if (typeof directory === 'string') {\n commands.push(directory);\n }\n\n return straightThroughStringTask(commands);\n}\n\nexport function cloneMirrorTask(repo: string | undefined, directory: string | undefined, customArgs: string[]): StringTask<string> {\n append(customArgs,'--mirror');\n\n return cloneTask(repo, directory, customArgs);\n}\n", "import { CommitResult } from '../../../typings';\nimport { LineParser, parseStringResponse } from '../utils';\n\nconst parsers: LineParser<CommitResult>[] = [\n new LineParser(/^\\[([^\\s]+)( \\([^)]+\\))? ([^\\]]+)/, (result, [branch, root, commit]) => {\n result.branch = branch;\n result.commit = commit;\n result.root = !!root;\n }),\n new LineParser(/\\s*Author:\\s(.+)/i, (result, [author]) => {\n const parts = author.split('<');\n const email = parts.pop();\n\n if (!email || !email.includes('@')) {\n return;\n }\n\n result.author = {\n email: email.substr(0, email.length - 1),\n name: parts.join('<').trim()\n };\n }),\n new LineParser(/(\\d+)[^,]*(?:,\\s*(\\d+)[^,]*)(?:,\\s*(\\d+))/g, (result, [changes, insertions, deletions]) => {\n result.summary.changes = parseInt(changes, 10) || 0;\n result.summary.insertions = parseInt(insertions, 10) || 0;\n result.summary.deletions = parseInt(deletions, 10) || 0;\n }),\n new LineParser(/^(\\d+)[^,]*(?:,\\s*(\\d+)[^(]+\\(([+-]))?/, (result, [changes, lines, direction]) => {\n result.summary.changes = parseInt(changes, 10) || 0;\n const count = parseInt(lines, 10) || 0;\n if (direction === '-') {\n result.summary.deletions = count;\n } else if (direction === '+') {\n result.summary.insertions = count;\n }\n }),\n];\n\nexport function parseCommitResult(stdOut: string): CommitResult {\n const result: CommitResult = {\n author: null,\n branch: '',\n commit: '',\n root: false,\n summary: {\n changes: 0,\n insertions: 0,\n deletions: 0,\n },\n };\n return parseStringResponse(result, parsers, stdOut);\n}\n", "import { CommitResult } from '../../../typings';\nimport { parseCommitResult } from '../parsers/parse-commit';\nimport { StringTask } from '../types';\n\nexport function commitTask(message: string[], files: string[], customArgs: string[]): StringTask<CommitResult> {\n const commands: string[] = ['commit'];\n\n message.forEach((m) => commands.push('-m', m));\n\n commands.push(\n ...files,\n ...customArgs,\n );\n\n return {\n commands,\n format: 'utf-8',\n parser: parseCommitResult,\n }\n}\n", "import { StringTask } from '../types';\nimport { DiffResult } from '../../../typings';\nimport { parseDiffResult } from '../parsers/parse-diff-summary';\n\nexport function diffSummaryTask(customArgs: string[]): StringTask<DiffResult> {\n return {\n commands: ['diff', '--stat=4096', ...customArgs],\n format: 'utf-8',\n parser (stdOut) {\n return parseDiffResult(stdOut);\n }\n }\n}\n", "import { FetchResult } from '../../../typings';\nimport { LineParser, parseStringResponse } from '../utils';\n\nconst parsers: LineParser<FetchResult>[] = [\n new LineParser(/From (.+)$/, (result, [remote]) => {\n result.remote = remote;\n }),\n new LineParser(/\\* \\[new branch]\\s+(\\S+)\\s*-> (.+)$/, (result, [name, tracking]) =>{\n result.branches.push({\n name,\n tracking,\n });\n }),\n new LineParser(/\\* \\[new tag]\\s+(\\S+)\\s*-> (.+)$/, (result, [name, tracking]) => {\n result.tags.push({\n name,\n tracking,\n });\n })\n];\n\nexport function parseFetchResult (stdOut: string, stdErr: string): FetchResult {\n const result: FetchResult = {\n raw: stdOut,\n remote: null,\n branches: [],\n tags: [],\n };\n return parseStringResponse(result, parsers, stdOut, stdErr);\n}\n", "import { FetchResult } from '../../../typings';\nimport { parseFetchResult } from '../parsers/parse-fetch';\nimport { StringTask } from '../types';\n\nexport function fetchTask(remote: string, branch: string, customArgs: string[]): StringTask<FetchResult> {\n const commands = ['fetch', ...customArgs];\n if (remote && branch) {\n commands.push(remote, branch);\n }\n\n return {\n commands,\n format: 'utf-8',\n parser: parseFetchResult,\n }\n}\n", "import { MoveResult } from '../../../typings';\nimport { LineParser, parseStringResponse } from '../utils';\n\nconst parsers: LineParser<MoveResult>[] = [\n new LineParser(/^Renaming (.+) to (.+)$/, (result, [from, to]) => {\n result.moves.push({from, to});\n }),\n];\n\nexport function parseMoveResult (stdOut: string): MoveResult {\n return parseStringResponse({moves: []}, parsers, stdOut);\n}\n", "import { MoveResult } from '../../../typings';\nimport { parseMoveResult } from '../parsers/parse-move';\nimport { StringTask } from '../types';\nimport { asArray } from '../utils';\n\nexport function moveTask(from: string | string[], to: string): StringTask<MoveResult> {\n return {\n commands: ['mv', '-v', ...asArray(from), to],\n format: 'utf-8',\n parser: parseMoveResult,\n };\n}\n", "import { PullResult } from '../../../typings';\nimport { GitResponseError } from '../errors/git-response-error';\nimport { parsePullErrorResult, parsePullResult } from '../parsers/parse-pull';\nimport { Maybe, StringTask } from '../types';\nimport { bufferToString } from '../utils';\n\nexport function pullTask(remote: Maybe<string>, branch: Maybe<string>, customArgs: string[]): StringTask<PullResult> {\n const commands: string[] = ['pull', ...customArgs];\n if (remote && branch) {\n commands.splice(1, 0, remote, branch);\n }\n\n return {\n commands,\n format: 'utf-8',\n parser(stdOut, stdErr): PullResult {\n return parsePullResult(stdOut, stdErr);\n },\n onError(result, _error, _done, fail) {\n const pullError = parsePullErrorResult(bufferToString(result.stdOut), bufferToString(result.stdErr));\n if (pullError) {\n return fail(new GitResponseError(pullError));\n }\n\n fail(_error);\n }\n }\n}\n", "import { forEachLineWithContent } from '../utils';\n\nexport interface RemoteWithoutRefs {\n name: string;\n}\n\nexport interface RemoteWithRefs extends RemoteWithoutRefs {\n refs: {\n fetch: string;\n push: string;\n };\n}\n\nexport function parseGetRemotes (text: string): RemoteWithoutRefs[] {\n const remotes: {[name: string]: RemoteWithoutRefs} = {};\n\n forEach(text, ([name]) => remotes[name] = { name });\n\n return Object.values(remotes);\n}\n\nexport function parseGetRemotesVerbose (text: string): RemoteWithRefs[] {\n const remotes: {[name: string]: RemoteWithRefs} = {};\n\n forEach(text, ([name, url, purpose]) => {\n if (!remotes.hasOwnProperty(name)) {\n remotes[name] = {\n name: name,\n refs: { fetch: '', push: '' },\n };\n }\n\n if (purpose && url) {\n remotes[name].refs[purpose.replace(/[^a-z]/g, '') as keyof RemoteWithRefs['refs']] = url;\n }\n });\n\n return Object.values(remotes);\n}\n\nfunction forEach(text: string, handler: (line: string[]) => void) {\n forEachLineWithContent(text, (line) => handler(line.split(/\\s+/)));\n}\n", "import { parseGetRemotes, parseGetRemotesVerbose } from '../responses/GetRemoteSummary';\nimport { StringTask } from '../types';\nimport { straightThroughStringTask } from './task';\n\nexport function addRemoteTask(remoteName: string, remoteRepo: string, customArgs: string[] = []): StringTask<string> {\n return straightThroughStringTask(['remote', 'add', ...customArgs, remoteName, remoteRepo]);\n}\n\nexport function getRemotesTask(verbose: boolean): StringTask<any> {\n const commands = ['remote'];\n if (verbose) {\n commands.push('-v');\n }\n\n return {\n commands,\n format: 'utf-8',\n parser: verbose ? parseGetRemotesVerbose : parseGetRemotes,\n };\n}\n\nexport function listRemotesTask(customArgs: string[] = []): StringTask<string> {\n const commands = [...customArgs];\n if (commands[0] !== 'ls-remote') {\n commands.unshift('ls-remote');\n }\n\n return straightThroughStringTask(commands);\n}\n\nexport function remoteTask(customArgs: string[] = []): StringTask<string> {\n const commands = [...customArgs];\n if (commands[0] !== 'remote') {\n commands.unshift('remote');\n }\n\n return straightThroughStringTask(commands);\n}\n\nexport function removeRemoteTask(remoteName: string) {\n return straightThroughStringTask(['remote', 'remove', remoteName]);\n}\n", "import { LogOptions, LogResult } from '../../../typings';\nimport { createListLogSummaryParser } from '../parsers/parse-list-log-summary';\nimport { StringTask } from '../types';\nimport { parseLogOptions } from './log';\n\nexport function stashListTask(opt: LogOptions = {}, customArgs: string[]): StringTask<LogResult> {\n const options = parseLogOptions<any>(opt);\n const parser = createListLogSummaryParser(options.splitter, options.fields);\n\n return {\n commands: ['stash', 'list', ...options.commands, ...customArgs],\n format: 'utf-8',\n parser,\n };\n}\n", "import { StringTask } from '../types';\nimport { straightThroughStringTask } from './task';\n\nexport function addSubModuleTask(repo: string, path: string): StringTask<string> {\n return subModuleTask(['add', repo, path]);\n}\n\nexport function initSubModuleTask(customArgs: string[]): StringTask<string> {\n return subModuleTask(['init', ...customArgs]);\n}\n\nexport function subModuleTask(customArgs: string[]): StringTask<string> {\n const commands = [...customArgs];\n if (commands[0] !== 'submodule') {\n commands.unshift('submodule');\n }\n\n return straightThroughStringTask(commands);\n}\n\nexport function updateSubModuleTask(customArgs: string[]): StringTask<string> {\n return subModuleTask(['update', ...customArgs]);\n}\n", "import { TagResult } from '../../../typings';\n\nexport class TagList implements TagResult {\n constructor(\n public readonly all: string[],\n public readonly latest: string | undefined,\n ) {\n }\n}\n\nexport const parseTagList = function (data: string, customSort = false) {\n const tags = data\n .split('\\n')\n .map(trimmed)\n .filter(Boolean);\n\n if (!customSort) {\n tags.sort(function (tagA, tagB) {\n const partsA = tagA.split('.');\n const partsB = tagB.split('.');\n\n if (partsA.length === 1 || partsB.length === 1) {\n return singleSorted(toNumber(partsA[0]), toNumber(partsB[0]));\n }\n\n for (let i = 0, l = Math.max(partsA.length, partsB.length); i < l; i++) {\n const diff = sorted(toNumber(partsA[i]), toNumber(partsB[i]));\n\n if (diff) {\n return diff;\n }\n }\n\n return 0;\n });\n }\n\n const latest = customSort ? tags[0] : [...tags].reverse().find((tag) => tag.indexOf('.') >= 0);\n\n return new TagList(tags, latest);\n};\n\nfunction singleSorted(a: number, b: number): number {\n const aIsNum = isNaN(a);\n const bIsNum = isNaN(b);\n\n if (aIsNum !== bIsNum) {\n return aIsNum ? 1 : -1;\n }\n\n return aIsNum ? sorted(a, b) : 0;\n}\n\nfunction sorted(a: number, b: number) {\n return a === b ? 0 : a > b ? 1 : -1;\n}\n\nfunction trimmed(input: string) {\n return input.trim();\n}\n\nfunction toNumber(input: string | undefined) {\n if (typeof input === 'string') {\n return parseInt(input.replace(/^\\D+/g, ''), 10) || 0;\n }\n\n return 0;\n}\n", "import { TagResult } from '../../../typings';\nimport { parseTagList } from '../responses/TagList';\nimport { StringTask } from '../types';\n\n/**\n * Task used by `git.tags`\n */\nexport function tagListTask (customArgs: string[] = []): StringTask<TagResult> {\n const hasCustomSort = customArgs.some((option) => /^--sort=/.test(option));\n\n return {\n format: 'utf-8',\n commands: ['tag', '-l', ...customArgs],\n parser (text: string) {\n return parseTagList(text, hasCustomSort);\n },\n }\n}\n\n/**\n * Task used by `git.addTag`\n */\nexport function addTagTask (name: string): StringTask<{name: string}> {\n return {\n format: 'utf-8',\n commands: ['tag', name],\n parser () {\n return {name};\n }\n }\n}\n\n/**\n * Task used by `git.addTag`\n */\nexport function addAnnotatedTagTask (name: string, tagMessage: string): StringTask<{name: string}> {\n return {\n format: 'utf-8',\n commands: ['tag', '-a', '-m', tagMessage, name],\n parser () {\n return {name};\n }\n }\n}\n", "const {GitExecutor} = require('./lib/runners/git-executor');\nconst {SimpleGitApi} = require('./lib/simple-git-api');\n\nconst {Scheduler} = require('./lib/runners/scheduler');\nconst {configurationErrorTask} = require('./lib/tasks/task');\nconst {\n asArray,\n filterArray,\n filterPrimitives,\n filterString,\n filterStringOrStringArray,\n filterType,\n getTrailingOptions,\n trailingFunctionArgument,\n trailingOptionsArgument\n} = require('./lib/utils');\nconst {applyPatchTask} = require('./lib/tasks/apply-patch')\nconst {branchTask, branchLocalTask, deleteBranchesTask, deleteBranchTask} = require('./lib/tasks/branch');\nconst {checkIgnoreTask} = require('./lib/tasks/check-ignore');\nconst {checkIsRepoTask} = require('./lib/tasks/check-is-repo');\nconst {cloneTask, cloneMirrorTask} = require('./lib/tasks/clone');\nconst {cleanWithOptionsTask, isCleanOptionsArray} = require('./lib/tasks/clean');\nconst {commitTask} = require('./lib/tasks/commit');\nconst {diffSummaryTask} = require('./lib/tasks/diff');\nconst {fetchTask} = require('./lib/tasks/fetch');\nconst {moveTask} = require(\"./lib/tasks/move\");\nconst {pullTask} = require('./lib/tasks/pull');\nconst {pushTagsTask} = require('./lib/tasks/push');\nconst {addRemoteTask, getRemotesTask, listRemotesTask, remoteTask, removeRemoteTask} = require('./lib/tasks/remote');\nconst {getResetMode, resetTask} = require('./lib/tasks/reset');\nconst {stashListTask} = require('./lib/tasks/stash-list');\nconst {addSubModuleTask, initSubModuleTask, subModuleTask, updateSubModuleTask} = require('./lib/tasks/sub-module');\nconst {addAnnotatedTagTask, addTagTask, tagListTask} = require('./lib/tasks/tag');\nconst {straightThroughBufferTask, straightThroughStringTask} = require('./lib/tasks/task');\n\nfunction Git (options, plugins) {\n this._executor = new GitExecutor(\n options.binary, options.baseDir,\n new Scheduler(options.maxConcurrentProcesses), plugins,\n );\n}\n\n(Git.prototype = Object.create(SimpleGitApi.prototype)).constructor = Git;\n\n/**\n * Sets the path to a custom git binary, should either be `git` when there is an installation of git available on\n * the system path, or a fully qualified path to the executable.\n *\n * @param {string} command\n * @returns {Git}\n */\nGit.prototype.customBinary = function (command) {\n this._executor.binary = command;\n return this;\n};\n\n/**\n * Sets an environment variable for the spawned child process, either supply both a name and value as strings or\n * a single object to entirely replace the current environment variables.\n *\n * @param {string|Object} name\n * @param {string} [value]\n * @returns {Git}\n */\nGit.prototype.env = function (name, value) {\n if (arguments.length === 1 && typeof name === 'object') {\n this._executor.env = name;\n } else {\n (this._executor.env = this._executor.env || {})[name] = value;\n }\n\n return this;\n};\n\n/**\n * List the stash(s) of the local repo\n */\nGit.prototype.stashList = function (options) {\n return this._runTask(\n stashListTask(\n trailingOptionsArgument(arguments) || {},\n filterArray(options) && options || []\n ),\n trailingFunctionArgument(arguments),\n );\n};\n\nfunction createCloneTask (api, task, repoPath, localPath) {\n if (typeof repoPath !== 'string') {\n return configurationErrorTask(`git.${ api }() requires a string 'repoPath'`);\n }\n\n return task(repoPath, filterType(localPath, filterString), getTrailingOptions(arguments));\n}\n\n\n/**\n * Clone a git repo\n */\nGit.prototype.clone = function () {\n return this._runTask(\n createCloneTask('clone', cloneTask, ...arguments),\n trailingFunctionArgument(arguments),\n );\n};\n\n/**\n * Mirror a git repo\n */\nGit.prototype.mirror = function () {\n return this._runTask(\n createCloneTask('mirror', cloneMirrorTask, ...arguments),\n trailingFunctionArgument(arguments),\n );\n};\n\n/**\n * Moves one or more files to a new destination.\n *\n * @see https://git-scm.com/docs/git-mv\n *\n * @param {string|string[]} from\n * @param {string} to\n */\nGit.prototype.mv = function (from, to) {\n return this._runTask(moveTask(from, to), trailingFunctionArgument(arguments));\n};\n\n/**\n * Internally uses pull and tags to get the list of tags then checks out the latest tag.\n *\n * @param {Function} [then]\n */\nGit.prototype.checkoutLatestTag = function (then) {\n var git = this;\n return this.pull(function () {\n git.tags(function (err, tags) {\n git.checkout(tags.latest, then);\n });\n });\n};\n\n/**\n * Commits changes in the current working directory - when specific file paths are supplied, only changes on those\n * files will be committed.\n *\n * @param {string|string[]} message\n * @param {string|string[]} [files]\n * @param {Object} [options]\n * @param {Function} [then]\n */\nGit.prototype.commit = function (message, files, options, then) {\n const next = trailingFunctionArgument(arguments);\n\n if (!filterStringOrStringArray(message)) {\n return this._runTask(\n configurationErrorTask('git.commit: requires the commit message to be supplied as a string/string[]'),\n next,\n );\n }\n\n return this._runTask(\n commitTask(\n asArray(message),\n asArray(filterType(files, filterStringOrStringArray, [])),\n [...filterType(options, filterArray, []), ...getTrailingOptions(arguments, 0, true)]\n ),\n next\n );\n};\n\n/**\n * Pull the updated contents of the current repo\n */\nGit.prototype.pull = function (remote, branch, options, then) {\n return this._runTask(\n pullTask(filterType(remote, filterString), filterType(branch, filterString), getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments),\n );\n};\n\n/**\n * Fetch the updated contents of the current repo.\n *\n * @example\n * .fetch('upstream', 'master') // fetches from master on remote named upstream\n * .fetch(function () {}) // runs fetch against default remote and branch and calls function\n *\n * @param {string} [remote]\n * @param {string} [branch]\n */\nGit.prototype.fetch = function (remote, branch) {\n return this._runTask(\n fetchTask(filterType(remote, filterString), filterType(branch, filterString), getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments),\n );\n};\n\n/**\n * Disables/enables the use of the console for printing warnings and errors, by default messages are not shown in\n * a production environment.\n *\n * @param {boolean} silence\n * @returns {Git}\n */\nGit.prototype.silent = function (silence) {\n console.warn('simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3');\n return this;\n};\n\n/**\n * List all tags. When using git 2.7.0 or above, include an options object with `\"--sort\": \"property-name\"` to\n * sort the tags by that property instead of using the default semantic versioning sort.\n *\n * Note, supplying this option when it is not supported by your Git version will cause the operation to fail.\n *\n * @param {Object} [options]\n * @param {Function} [then]\n */\nGit.prototype.tags = function (options, then) {\n return this._runTask(\n tagListTask(getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments),\n );\n};\n\n/**\n * Rebases the current working copy. Options can be supplied either as an array of string parameters\n * to be sent to the `git rebase` command, or a standard options object.\n */\nGit.prototype.rebase = function () {\n return this._runTask(\n straightThroughStringTask(['rebase', ...getTrailingOptions(arguments)]),\n trailingFunctionArgument(arguments)\n );\n};\n\n/**\n * Reset a repo\n */\nGit.prototype.reset = function (mode) {\n return this._runTask(\n resetTask(getResetMode(mode), getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments),\n );\n};\n\n/**\n * Revert one or more commits in the local working copy\n */\nGit.prototype.revert = function (commit) {\n const next = trailingFunctionArgument(arguments);\n\n if (typeof commit !== 'string') {\n return this._runTask(\n configurationErrorTask('Commit must be a string'),\n next,\n );\n }\n\n return this._runTask(\n straightThroughStringTask(['revert', ...getTrailingOptions(arguments, 0, true), commit]),\n next\n );\n};\n\n/**\n * Add a lightweight tag to the head of the current branch\n */\nGit.prototype.addTag = function (name) {\n const task = (typeof name === 'string')\n ? addTagTask(name)\n : configurationErrorTask('Git.addTag requires a tag name');\n\n return this._runTask(task, trailingFunctionArgument(arguments));\n};\n\n/**\n * Add an annotated tag to the head of the current branch\n */\nGit.prototype.addAnnotatedTag = function (tagName, tagMessage) {\n return this._runTask(\n addAnnotatedTagTask(tagName, tagMessage),\n trailingFunctionArgument(arguments),\n );\n};\n\n/**\n * Check out a tag or revision, any number of additional arguments can be passed to the `git checkout` command\n * by supplying either a string or array of strings as the first argument.\n */\nGit.prototype.checkout = function () {\n const commands = ['checkout', ...getTrailingOptions(arguments, true)];\n return this._runTask(\n straightThroughStringTask(commands),\n trailingFunctionArgument(arguments),\n );\n};\n\n/**\n * Check out a remote branch\n *\n * @param {string} branchName name of branch\n * @param {string} startPoint (e.g origin/development)\n * @param {Function} [then]\n */\nGit.prototype.checkoutBranch = function (branchName, startPoint, then) {\n return this.checkout(['-b', branchName, startPoint], trailingFunctionArgument(arguments));\n};\n\n/**\n * Check out a local branch\n */\nGit.prototype.checkoutLocalBranch = function (branchName, then) {\n return this.checkout(['-b', branchName], trailingFunctionArgument(arguments));\n};\n\n/**\n * Delete a local branch\n */\nGit.prototype.deleteLocalBranch = function (branchName, forceDelete, then) {\n return this._runTask(\n deleteBranchTask(branchName, typeof forceDelete === \"boolean\" ? forceDelete : false),\n trailingFunctionArgument(arguments),\n );\n};\n\n/**\n * Delete one or more local branches\n */\nGit.prototype.deleteLocalBranches = function (branchNames, forceDelete, then) {\n return this._runTask(\n deleteBranchesTask(branchNames, typeof forceDelete === \"boolean\" ? forceDelete : false),\n trailingFunctionArgument(arguments),\n );\n};\n\n/**\n * List all branches\n *\n * @param {Object | string[]} [options]\n * @param {Function} [then]\n */\nGit.prototype.branch = function (options, then) {\n return this._runTask(\n branchTask(getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments),\n );\n};\n\n/**\n * Return list of local branches\n *\n * @param {Function} [then]\n */\nGit.prototype.branchLocal = function (then) {\n return this._runTask(\n branchLocalTask(),\n trailingFunctionArgument(arguments),\n );\n};\n\n/**\n * Executes any command against the git binary.\n */\nGit.prototype.raw = function (commands) {\n const createRestCommands = !Array.isArray(commands);\n const command = [].slice.call(createRestCommands ? arguments : commands, 0);\n\n for (let i = 0; i < command.length && createRestCommands; i++) {\n if (!filterPrimitives(command[i])) {\n command.splice(i, command.length - i);\n break;\n }\n }\n\n command.push(\n ...getTrailingOptions(arguments, 0, true),\n );\n\n var next = trailingFunctionArgument(arguments);\n\n if (!command.length) {\n return this._runTask(\n configurationErrorTask('Raw: must supply one or more command to execute'),\n next,\n );\n }\n\n return this._runTask(straightThroughStringTask(command), next);\n};\n\nGit.prototype.submoduleAdd = function (repo, path, then) {\n return this._runTask(\n addSubModuleTask(repo, path),\n trailingFunctionArgument(arguments),\n );\n};\n\nGit.prototype.submoduleUpdate = function (args, then) {\n return this._runTask(\n updateSubModuleTask(getTrailingOptions(arguments, true)),\n trailingFunctionArgument(arguments),\n );\n};\n\nGit.prototype.submoduleInit = function (args, then) {\n return this._runTask(\n initSubModuleTask(getTrailingOptions(arguments, true)),\n trailingFunctionArgument(arguments),\n );\n};\n\nGit.prototype.subModule = function (options, then) {\n return this._runTask(\n subModuleTask(getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments),\n );\n};\n\nGit.prototype.listRemote = function () {\n return this._runTask(\n listRemotesTask(getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments),\n );\n};\n\n/**\n * Adds a remote to the list of remotes.\n */\nGit.prototype.addRemote = function (remoteName, remoteRepo, then) {\n return this._runTask(\n addRemoteTask(remoteName, remoteRepo, getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments),\n );\n};\n\n/**\n * Removes an entry by name from the list of remotes.\n */\nGit.prototype.removeRemote = function (remoteName, then) {\n return this._runTask(\n removeRemoteTask(remoteName),\n trailingFunctionArgument(arguments),\n );\n};\n\n/**\n * Gets the currently available remotes, setting the optional verbose argument to true includes additional\n * detail on the remotes themselves.\n */\nGit.prototype.getRemotes = function (verbose, then) {\n return this._runTask(\n getRemotesTask(verbose === true),\n trailingFunctionArgument(arguments),\n );\n};\n\n/**\n * Call any `git remote` function with arguments passed as an array of strings.\n *\n * @param {string[]} options\n * @param {Function} [then]\n */\nGit.prototype.remote = function (options, then) {\n return this._runTask(\n remoteTask(getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments),\n );\n};\n\n/**\n * Call any `git tag` function with arguments passed as an array of strings.\n *\n * @param {string[]} options\n * @param {Function} [then]\n */\nGit.prototype.tag = function (options, then) {\n const command = getTrailingOptions(arguments);\n\n if (command[0] !== 'tag') {\n command.unshift('tag');\n }\n\n return this._runTask(\n straightThroughStringTask(command),\n trailingFunctionArgument(arguments)\n );\n};\n\n/**\n * Updates repository server info\n *\n * @param {Function} [then]\n */\nGit.prototype.updateServerInfo = function (then) {\n return this._runTask(\n straightThroughStringTask(['update-server-info']),\n trailingFunctionArgument(arguments),\n );\n};\n\n/**\n * Pushes the current tag changes to a remote which can be either a URL or named remote. When not specified uses the\n * default configured remote spec.\n *\n * @param {string} [remote]\n * @param {Function} [then]\n */\nGit.prototype.pushTags = function (remote, then) {\n const task = pushTagsTask({remote: filterType(remote, filterString)}, getTrailingOptions(arguments));\n\n return this._runTask(task, trailingFunctionArgument(arguments));\n};\n\n/**\n * Removes the named files from source control.\n */\nGit.prototype.rm = function (files) {\n return this._runTask(\n straightThroughStringTask(['rm', '-f', ...asArray(files)]),\n trailingFunctionArgument(arguments)\n );\n};\n\n/**\n * Removes the named files from source control but keeps them on disk rather than deleting them entirely. To\n * completely remove the files, use `rm`.\n *\n * @param {string|string[]} files\n */\nGit.prototype.rmKeepLocal = function (files) {\n return this._runTask(\n straightThroughStringTask(['rm', '--cached', ...asArray(files)]),\n trailingFunctionArgument(arguments)\n );\n};\n\n/**\n * Returns a list of objects in a tree based on commit hash. Passing in an object hash returns the object's content,\n * size, and type.\n *\n * Passing \"-p\" will instruct cat-file to determine the object type, and display its formatted contents.\n *\n * @param {string[]} [options]\n * @param {Function} [then]\n */\nGit.prototype.catFile = function (options, then) {\n return this._catFile('utf-8', arguments);\n};\n\nGit.prototype.binaryCatFile = function () {\n return this._catFile('buffer', arguments);\n};\n\nGit.prototype._catFile = function (format, args) {\n var handler = trailingFunctionArgument(args);\n var command = ['cat-file'];\n var options = args[0];\n\n if (typeof options === 'string') {\n return this._runTask(\n configurationErrorTask('Git.catFile: options must be supplied as an array of strings'),\n handler,\n );\n }\n\n if (Array.isArray(options)) {\n command.push.apply(command, options);\n }\n\n const task = format === 'buffer'\n ? straightThroughBufferTask(command)\n : straightThroughStringTask(command);\n\n return this._runTask(task, handler);\n};\n\nGit.prototype.diff = function (options, then) {\n const task = filterString(options)\n ? configurationErrorTask('git.diff: supplying options as a single string is no longer supported, switch to an array of strings')\n : straightThroughStringTask(['diff', ...getTrailingOptions(arguments)]);\n\n return this._runTask(\n task,\n trailingFunctionArgument(arguments),\n );\n};\n\nGit.prototype.diffSummary = function () {\n return this._runTask(\n diffSummaryTask(getTrailingOptions(arguments, 1)),\n trailingFunctionArgument(arguments),\n );\n};\n\nGit.prototype.applyPatch = function (patches) {\n const task = !filterStringOrStringArray(patches)\n ? configurationErrorTask(`git.applyPatch requires one or more string patches as the first argument`)\n : applyPatchTask(asArray(patches), getTrailingOptions([].slice.call(arguments, 1)));\n\n return this._runTask(\n task,\n trailingFunctionArgument(arguments),\n );\n}\n\nGit.prototype.revparse = function () {\n const commands = ['rev-parse', ...getTrailingOptions(arguments, true)];\n return this._runTask(\n straightThroughStringTask(commands, true),\n trailingFunctionArgument(arguments),\n );\n};\n\n/**\n * Show various types of objects, for example the file at a certain commit\n *\n * @param {string[]} [options]\n * @param {Function} [then]\n */\nGit.prototype.show = function (options, then) {\n return this._runTask(\n straightThroughStringTask(['show', ...getTrailingOptions(arguments, 1)]),\n trailingFunctionArgument(arguments)\n );\n};\n\n/**\n */\nGit.prototype.clean = function (mode, options, then) {\n const usingCleanOptionsArray = isCleanOptionsArray(mode);\n const cleanMode = usingCleanOptionsArray && mode.join('') || filterType(mode, filterString) || '';\n const customArgs = getTrailingOptions([].slice.call(arguments, usingCleanOptionsArray ? 1 : 0));\n\n return this._runTask(\n cleanWithOptionsTask(cleanMode, customArgs),\n trailingFunctionArgument(arguments),\n );\n};\n\nGit.prototype.exec = function (then) {\n const task = {\n commands: [],\n format: 'utf-8',\n parser () {\n if (typeof then === 'function') {\n then();\n }\n }\n };\n\n return this._runTask(task);\n};\n\n/**\n * Clears the queue of pending commands and returns the wrapper instance for chaining.\n *\n * @returns {Git}\n */\nGit.prototype.clearQueue = function () {\n // TODO:\n // this._executor.clear();\n return this;\n};\n\n/**\n * Check if a pathname or pathnames are excluded by .gitignore\n *\n * @param {string|string[]} pathnames\n * @param {Function} [then]\n */\nGit.prototype.checkIgnore = function (pathnames, then) {\n return this._runTask(\n checkIgnoreTask(asArray((filterType(pathnames, filterStringOrStringArray, [])))),\n trailingFunctionArgument(arguments),\n );\n};\n\nGit.prototype.checkIsRepo = function (checkType, then) {\n return this._runTask(\n checkIsRepoTask(filterType(checkType, filterString)),\n trailingFunctionArgument(arguments),\n );\n};\n\nmodule.exports = Git;\n", "import { GitError } from './git-error';\nimport { SimpleGitOptions } from '../types';\n\n/**\n * The `GitConstructError` is thrown when an error occurs in the constructor\n * of the `simple-git` instance itself. Most commonly as a result of using\n * a `baseDir` option that points to a folder that either does not exist,\n * or cannot be read by the user the node script is running as.\n *\n * Check the `.message` property for more detail including the properties\n * passed to the constructor.\n */\nexport class GitConstructError extends GitError {\n\n constructor (\n public readonly config: SimpleGitOptions,\n message: string,\n ) {\n super(undefined, message);\n }\n\n}\n", "import { GitConstructError } from './errors/git-construct-error';\nimport { GitError } from './errors/git-error';\nimport { GitPluginError } from './errors/git-plugin-error';\nimport { GitResponseError } from './errors/git-response-error';\nimport { TaskConfigurationError } from './errors/task-configuration-error';\nimport { CheckRepoActions } from './tasks/check-is-repo';\nimport { CleanOptions } from './tasks/clean';\nimport { GitConfigScope } from './tasks/config';\nimport { grepQueryBuilder } from './tasks/grep';\nimport { ResetMode } from './tasks/reset';\n\nexport {\n CheckRepoActions,\n CleanOptions,\n GitConfigScope,\n GitConstructError,\n GitError,\n GitPluginError,\n GitResponseError,\n ResetMode,\n TaskConfigurationError,\n grepQueryBuilder,\n};\n\n// export const api = {\n// CheckRepoActions,\n// CleanOptions,\n// GitConfigScope,\n// GitConstructError,\n// GitError,\n// GitPluginError,\n// GitResponseError,\n// ResetMode,\n// TaskConfigurationError,\n// grepQueryBuilder,\n// };\n", "import { SimpleGitOptions, SimpleGitTask } from '../types';\nimport { GitError } from './git-error';\n\nexport class GitPluginError extends GitError {\n\n constructor (\n public task?: SimpleGitTask<any>,\n public readonly plugin?: keyof SimpleGitOptions,\n message?: string,\n ) {\n super(task, message);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n}\n", "import { prefixedArray } from '../utils';\nimport { SimpleGitPlugin } from './simple-git-plugin';\n\nexport function commandConfigPrefixingPlugin(configuration: string[]): SimpleGitPlugin<'spawn.args'> {\n const prefix = prefixedArray(configuration, '-c');\n\n return {\n type: 'spawn.args',\n action(data) {\n return [...prefix, ...data];\n },\n };\n}\n", "import { deferred, DeferredPromise } from '@kwsites/promise-deferred';\nimport { SimpleGitPluginConfig } from '../types';\nimport { delay } from '../utils';\nimport { SimpleGitPlugin } from './simple-git-plugin';\n\nconst never = deferred().promise;\n\nexport function completionDetectionPlugin({\n onClose = true,\n onExit = 50\n }: SimpleGitPluginConfig['completion'] = {}): SimpleGitPlugin<'spawn.after'> {\n\n function createEvents() {\n let exitCode = -1;\n const events = {\n close: deferred(),\n closeTimeout: deferred(),\n exit: deferred(),\n exitTimeout: deferred(),\n };\n\n const result = Promise.race([\n onClose === false ? never : events.closeTimeout.promise,\n onExit === false ? never : events.exitTimeout.promise,\n ]);\n\n configureTimeout(onClose, events.close, events.closeTimeout);\n configureTimeout(onExit, events.exit, events.exitTimeout);\n\n return {\n close(code: number) {\n exitCode = code;\n events.close.done();\n },\n exit(code: number) {\n exitCode = code;\n events.exit.done();\n },\n get exitCode() {\n return exitCode;\n },\n result,\n };\n }\n\n function configureTimeout(flag: boolean | number, event: DeferredPromise<void>, timeout: DeferredPromise<void>) {\n if (flag === false) {\n return;\n }\n\n (flag === true ? event.promise : event.promise.then(() => delay(flag))).then(timeout.done);\n }\n\n return {\n type: 'spawn.after',\n async action(_data, {spawned, close}) {\n const events = createEvents();\n\n let deferClose = true;\n let quickClose = () => void (deferClose = false);\n\n spawned.stdout?.on('data', quickClose);\n spawned.stderr?.on('data', quickClose);\n spawned.on('error', quickClose);\n\n spawned.on('close', (code: number) => events.close(code));\n spawned.on('exit', (code: number) => events.exit(code));\n\n try{\n await events.result;\n if (deferClose) {\n await delay(50);\n }\n close(events.exitCode);\n }\n catch (err) {\n close(events.exitCode, err);\n }\n }\n }\n}\n", "import { GitError } from '../errors/git-error';\nimport { GitExecutorResult, SimpleGitPluginConfig } from '../types';\nimport { SimpleGitPlugin } from './simple-git-plugin';\n\ntype TaskResult = Omit<GitExecutorResult, 'rejection'>;\n\nfunction isTaskError (result: TaskResult) {\n return !!(result.exitCode && result.stdErr.length);\n}\n\nfunction getErrorMessage (result: TaskResult) {\n return Buffer.concat([...result.stdOut, ...result.stdErr]);\n}\n\nexport function errorDetectionHandler (overwrite = false, isError = isTaskError, errorMessage: (result: TaskResult) => Buffer | Error = getErrorMessage) {\n\n return (error: Buffer | Error | undefined, result: TaskResult) => {\n if ((!overwrite && error) || !isError(result)) {\n return error;\n }\n\n return errorMessage(result);\n };\n}\n\nexport function errorDetectionPlugin(config: SimpleGitPluginConfig['errors']): SimpleGitPlugin<'task.error'> {\n\n return {\n type: 'task.error',\n action(data, context) {\n const error = config(data.error, {\n stdErr: context.stdErr,\n stdOut: context.stdOut,\n exitCode: context.exitCode\n });\n\n if (Buffer.isBuffer(error)) {\n return {error: new GitError(undefined, error.toString('utf-8'))};\n }\n\n return {\n error\n };\n },\n };\n\n}\n", "import { SimpleGitPlugin, SimpleGitPluginType, SimpleGitPluginTypes } from './simple-git-plugin';\nimport { append, asArray } from '../utils';\n\nexport class PluginStore {\n\n private plugins: Set<SimpleGitPlugin<SimpleGitPluginType>> = new Set();\n\n public add<T extends SimpleGitPluginType>(plugin: void | SimpleGitPlugin<T> | SimpleGitPlugin<T>[]) {\n const plugins: SimpleGitPlugin<T>[] = [];\n\n asArray(plugin).forEach(plugin => plugin && this.plugins.add(append(plugins, plugin)));\n\n return () => {\n plugins.forEach(plugin => this.plugins.delete(plugin));\n };\n }\n\n public exec<T extends SimpleGitPluginType>(type: T, data: SimpleGitPluginTypes[T]['data'], context: SimpleGitPluginTypes[T]['context']): typeof data {\n let output = data;\n const contextual = Object.freeze(Object.create(context));\n\n for (const plugin of this.plugins) {\n if (plugin.type === type) {\n output = plugin.action(output, contextual);\n }\n }\n\n return output;\n }\n\n}\n", "import { SimpleGitOptions } from '../types';\nimport { asNumber, including } from '../utils';\n\nimport { SimpleGitPlugin } from './simple-git-plugin';\n\nexport function progressMonitorPlugin(progress: Exclude<SimpleGitOptions['progress'], void>) {\n const progressCommand = '--progress';\n const progressMethods = ['checkout', 'clone', 'fetch', 'pull', 'push'];\n\n const onProgress: SimpleGitPlugin<'spawn.after'> = {\n type: 'spawn.after',\n action(_data, context) {\n if (!context.commands.includes(progressCommand)) {\n return;\n }\n\n context.spawned.stderr?.on('data', (chunk: Buffer) => {\n const message = /^([\\s\\S]+?):\\s*(\\d+)% \\((\\d+)\\/(\\d+)\\)/.exec(chunk.toString('utf8'));\n if (!message) {\n return;\n }\n\n progress({\n method: context.method,\n stage: progressEventStage(message[1]),\n progress: asNumber(message[2]),\n processed: asNumber(message[3]),\n total: asNumber(message[4]),\n });\n });\n }\n };\n\n const onArgs: SimpleGitPlugin<'spawn.args'> = {\n type: 'spawn.args',\n action(args, context) {\n if (!progressMethods.includes(context.method)) {\n return args;\n }\n\n return including(args, progressCommand);\n }\n }\n\n return [onArgs, onProgress];\n}\n\nfunction progressEventStage (input: string) {\n return String(input.toLowerCase().split(' ', 1)) || 'unknown';\n}\n", "import { SpawnOptions } from 'child_process';\nimport { pick } from '../utils';\nimport { SimpleGitPlugin } from './simple-git-plugin';\n\nexport function spawnOptionsPlugin(spawnOptions: Partial<SpawnOptions>): SimpleGitPlugin<'spawn.options'> {\n const options = pick(spawnOptions, ['uid', 'gid']);\n\n return {\n type: 'spawn.options',\n action(data) {\n return {...options, ...data};\n },\n };\n}\n", "import { SimpleGitOptions } from '../types';\n\nimport { SimpleGitPlugin } from './simple-git-plugin';\nimport { GitPluginError } from '../errors/git-plugin-error';\n\nexport function timeoutPlugin({block}: Exclude<SimpleGitOptions['timeout'], undefined>): SimpleGitPlugin<'spawn.after'> | void {\n\n if (block > 0) {\n return {\n type: 'spawn.after',\n action(_data, context) {\n let timeout: NodeJS.Timeout;\n\n function wait() {\n timeout && clearTimeout(timeout);\n timeout = setTimeout(kill, block);\n }\n\n function stop() {\n context.spawned.stdout?.off('data', wait);\n context.spawned.stderr?.off('data', wait);\n context.spawned.off('exit', stop);\n context.spawned.off('close', stop);\n }\n\n function kill() {\n stop()\n context.kill(\n new GitPluginError(undefined, 'timeout', `block timeout reached`)\n );\n }\n\n context.spawned.stdout?.on('data', wait);\n context.spawned.stderr?.on('data', wait);\n context.spawned.on('exit', stop);\n context.spawned.on('close', stop);\n\n wait();\n }\n }\n }\n\n}\n", "import { SimpleGitFactory } from '../../typings';\n\nimport * as api from './api';\nimport {\n commandConfigPrefixingPlugin,\n completionDetectionPlugin,\n errorDetectionHandler,\n errorDetectionPlugin,\n PluginStore,\n progressMonitorPlugin,\n spawnOptionsPlugin,\n timeoutPlugin\n} from './plugins';\nimport { createInstanceConfig, folderExists } from './utils';\nimport { SimpleGitOptions } from './types';\n\nconst Git = require('../git');\n\n/**\n * Adds the necessary properties to the supplied object to enable it for use as\n * the default export of a module.\n *\n * Eg: `module.exports = esModuleFactory({ something () {} })`\n */\nexport function esModuleFactory<T>(defaultExport: T): T & { __esModule: true, default: T } {\n return Object.defineProperties(defaultExport, {\n __esModule: {value: true},\n default: {value: defaultExport},\n });\n}\n\nexport function gitExportFactory<T = {}>(factory: SimpleGitFactory, extra: T) {\n return Object.assign(function (...args: Parameters<SimpleGitFactory>) {\n return factory.apply(null, args);\n },\n api,\n extra || {},\n );\n}\n\nexport function gitInstanceFactory(baseDir?: string | Partial<SimpleGitOptions>, options?: Partial<SimpleGitOptions>) {\n const plugins = new PluginStore();\n const config = createInstanceConfig(\n baseDir && (typeof baseDir === 'string' ? {baseDir} : baseDir) || {},\n options\n );\n\n if (!folderExists(config.baseDir)) {\n throw new api.GitConstructError(config, `Cannot use simple-git on a directory that does not exist`);\n }\n\n if (Array.isArray(config.config)) {\n plugins.add(commandConfigPrefixingPlugin(config.config));\n }\n\n plugins.add(completionDetectionPlugin(config.completion));\n config.progress && plugins.add(progressMonitorPlugin(config.progress));\n config.timeout && plugins.add(timeoutPlugin(config.timeout));\n config.spawnOptions && plugins.add(spawnOptionsPlugin(config.spawnOptions));\n\n plugins.add(errorDetectionPlugin(errorDetectionHandler(true)));\n config.errors && plugins.add(errorDetectionPlugin(config.errors));\n\n return new Git(config, plugins);\n}\n", "import { SimpleGit, SimpleGitOptions } from '../../../typings';\n\nimport { GitResponseError } from '../errors/git-response-error';\nimport { gitInstanceFactory } from '../git-factory';\nimport { SimpleGitTaskCallback } from '../types';\n\nconst functionNamesBuilderApi = [\n 'customBinary', 'env', 'outputHandler', 'silent',\n];\n\nconst functionNamesPromiseApi = [\n 'add',\n 'addAnnotatedTag',\n 'addConfig',\n 'addRemote',\n 'addTag',\n 'applyPatch',\n 'binaryCatFile',\n 'branch',\n 'branchLocal',\n 'catFile',\n 'checkIgnore',\n 'checkIsRepo',\n 'checkout',\n 'checkoutBranch',\n 'checkoutLatestTag',\n 'checkoutLocalBranch',\n 'clean',\n 'clone',\n 'commit',\n 'cwd',\n 'deleteLocalBranch',\n 'deleteLocalBranches',\n 'diff',\n 'diffSummary',\n 'exec',\n 'fetch',\n 'getRemotes',\n 'init',\n 'listConfig',\n 'listRemote',\n 'log',\n 'merge',\n 'mergeFromTo',\n 'mirror',\n 'mv',\n 'pull',\n 'push',\n 'pushTags',\n 'raw',\n 'rebase',\n 'remote',\n 'removeRemote',\n 'reset',\n 'revert',\n 'revparse',\n 'rm',\n 'rmKeepLocal',\n 'show',\n 'stash',\n 'stashList',\n 'status',\n 'subModule',\n 'submoduleAdd',\n 'submoduleInit',\n 'submoduleUpdate',\n 'tag',\n 'tags',\n 'updateServerInfo'\n];\n\nexport function gitP(...args: [] | [string] | [Partial<SimpleGitOptions>] | [string, Partial<SimpleGitOptions>]): SimpleGit {\n\n let git: any;\n\n let chain = Promise.resolve();\n\n try {\n git = gitInstanceFactory(...args);\n } catch (e) {\n chain = Promise.reject(e);\n }\n\n function builderReturn() {\n return promiseApi;\n }\n\n function chainReturn() {\n return chain;\n }\n\n const promiseApi = [...functionNamesBuilderApi, ...functionNamesPromiseApi].reduce((api: any, name: string) => {\n const isAsync = functionNamesPromiseApi.includes(name);\n\n const valid = isAsync ? asyncWrapper(name, git) : syncWrapper(name, git, api);\n const alternative = isAsync ? chainReturn : builderReturn;\n\n Object.defineProperty(api, name, {\n enumerable: false,\n configurable: false,\n value: git ? valid : alternative,\n });\n\n return api;\n }, {});\n\n return promiseApi as SimpleGit;\n\n function asyncWrapper(fn: string, git: any): (...args: any[]) => Promise<any> {\n return function (...args: any[]) {\n if (typeof args[args.length] === 'function') {\n throw new TypeError(\n 'Promise interface requires that handlers are not supplied inline, ' +\n 'trailing function not allowed in call to ' + fn);\n }\n\n return chain.then(function () {\n return new Promise(function (resolve, reject) {\n const callback: SimpleGitTaskCallback = (err: Error | null, result?: any) => {\n if (err) {\n return reject(toError(err));\n }\n\n resolve(result);\n };\n args.push(callback);\n\n git[fn].apply(git, args);\n });\n });\n };\n }\n\n function syncWrapper(fn: string, git: any, api: SimpleGit) {\n return (...args: any[]) => {\n git[fn](...args);\n\n return api;\n };\n }\n}\n\nfunction toError(error: Error | string | any): Error {\n\n if (error instanceof Error) {\n return error;\n }\n\n if (typeof error === 'string') {\n return new Error(error);\n }\n\n return new GitResponseError(error);\n}\n", "import { gitInstanceFactory } from './lib/git-factory';\n\nexport {gitP} from './lib/runners/promise-wrapped';\nexport * from './lib/api';\n\nexport default gitInstanceFactory;\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IA2BO;AA3BP;AAAA;AA2BO,6BAAuB,MAAM;AAAA,MAEjC,YACU,MACP,SACD;AACC,cAAM;AAHC;AAIP,eAAO,eAAe,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA;;;AClC7C,IAsBO;AAtBP;AAAA;AAAA;AAsBO,qCAAwC,SAAS;AAAA,MAErD,YAImB,KAChB,SACD;AACC,cAAM,QAAW,WAAW,OAAO;AAHnB;AAAA;AAAA;AAAA;AAAA;;;AC5BtB,IAUO;AAVP;AAAA;AAAA;AAUO,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AAgB;AACxD,WAAO,IAAI,UAAgB;AACxB,WAAI,IAAI,GAAG;AAEX,aAAO;AAAA;AAAA;AAAA;AAKhB,iBAAiB,OAAoC;AAElD,MAAI,iBAAiB,OAAO;AACzB,WAAO;AAAA;AAGV,MAAI,OAAO,UAAU,UAAU;AAC5B,WAAO,IAAI,MAAM;AAAA;AAGpB,SAAO,IAAI,iBAAiB;AAAA;;;ACnJ/B,IAAO,cAAQ;", + "names": [] +} diff --git a/node_modules/simple-git/esm/package.json b/node_modules/simple-git/esm/package.json new file mode 100644 index 0000000..aead43d --- /dev/null +++ b/node_modules/simple-git/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +}
\ No newline at end of file |