UNPKG

git-flush

Version:

Commits and pushes if repository is dirty. Does nothing otherwise.

6 lines 29.3 kB
/*! *** git-flush 2.0.2 *** Copyright © 2020, Jaid <jaid.jsx@gmail.com> (https://github.com/Jaid) *** @license MIT !*/ var t,n;t=global,n=function(){return function(t){var n={};function r(e){if(n[e])return n[e].exports;var i=n[e]={i:e,l:!1,exports:{}};return t[e].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=n,r.d=function(t,n,e){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var i in t)r.d(e,i,function(n){return t[n]}.bind(null,i));return e},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="",r(r.s=7)}([function(t,n,r){!function(){var n=r(1)("simple-git"),e=r(8),i=r(2),o=function(){},s=r(10);function u(t,n,r){this._baseDir=t,this._runCache=[],this.ChildProcess=n,this.Buffer=r}function a(t){return s[t]}u.prototype._command="git",u.prototype._env=null,u.prototype._outputHandler=null,u.prototype._silentLogging=/prod/.test(process.env.NODE_ENV),u.prototype.customBinary=function(t){return this._command=t,this},u.prototype.env=function(t,n){return 1===arguments.length&&"object"==typeof t?this._env=t:(this._env=this._env||{})[t]=n,this},u.prototype.cwd=function(t,n){var r=this,e=u.trailingFunctionArgument(arguments);return this.exec((function(){r._baseDir=t,i(t,i.FOLDER)?e&&e(null,t):u.exception(r,'Git.cwd: cannot change to non-directory "'+t+'"',e)}))},u.prototype.outputHandler=function(t){return this._outputHandler=t,this},u.prototype.init=function(t,n){var r=["init"],e=u.trailingFunctionArgument(arguments);return!0===t&&r.push("--bare"),this._run(r,(function(t){e&&e(t)}))},u.prototype.status=function(t){return this._run(["status","--porcelain","-b","-u"],u._responseHandler(t,"StatusSummary"))},u.prototype.stashList=function(t,n){var r=u.trailingFunctionArgument(arguments),e=(r===n?t:null)||{},i=e.splitter||a("ListLogSummary").SPLITTER,o=["stash","list","--pretty=format:"+a("ListLogSummary").START_BOUNDARY+"%H %ai %s%d %aN %ae".replace(/\s+/g,i)+a("ListLogSummary").COMMIT_BOUNDARY];return Array.isArray(e)&&(o=o.concat(e)),this._run(o,u._responseHandler(r,"ListLogSummary",i))},u.prototype.stash=function(t,n){var r=["stash"];return u._appendOptions(r,u.trailingOptionsArgument(arguments)),r.push.apply(r,u.trailingArrayArgument(arguments)),this._run(r,u._responseHandler(u.trailingFunctionArgument(arguments)))},u.prototype.clone=function(t,n,r,e){for(var i=u.trailingFunctionArgument(arguments),o=["clone"].concat(u.trailingArrayArgument(arguments)),s=0,a=arguments.length;a>s;s++)"string"==typeof arguments[s]&&o.push(arguments[s]);return this._run(o,(function(t,n){i&&i(t,n)}))},u.prototype.mirror=function(t,n,r){return this.clone(t,n,["--mirror"],r)},u.prototype.mv=function(t,n,r){var e=u.trailingFunctionArgument(arguments),i=[].concat(t);i.unshift("mv","-v"),i.push(n),this._run(i,u._responseHandler(e,"MoveSummary"))},u.prototype.checkoutLatestTag=function(t){var n=this;return this.pull((function(){n.tags((function(r,e){n.checkout(e.latest,t)}))}))},u.prototype.add=function(t,n){return this._run(["add"].concat(t),(function(t,r){n&&n(t)}))},u.prototype.commit=function(t,n,r,e){var i=u.trailingFunctionArgument(arguments),o=["commit"];return[].concat(t).forEach((function(t){o.push("-m",t)})),[].push.apply(o,[].concat("string"==typeof n||Array.isArray(n)?n:[])),u._appendOptions(o,u.trailingOptionsArgument(arguments)),this._run(o,u._responseHandler(i,"CommitSummary"))},u.prototype._getLog=function(t,n){var r=this._silentLogging?o:console[t].bind(console);return arguments.length>1&&r(n),r},u.prototype.pull=function(t,n,r,e){var i=["pull"],o=u.trailingFunctionArgument(arguments);return"string"==typeof t&&"string"==typeof n&&i.push(t,n),u._appendOptions(i,u.trailingOptionsArgument(arguments)),this._run(i,u._responseHandler(o,"PullSummary"))},u.prototype.fetch=function(t,n,r){var e=["fetch"],i=u.trailingFunctionArgument(arguments);return u._appendOptions(e,u.trailingOptionsArgument(arguments)),"string"==typeof t&&"string"==typeof n&&e.push(t,n),Array.isArray(t)&&(e=e.concat(t)),this._run(e,u._responseHandler(i,"FetchSummary"),{concatStdErr:!0})},u.prototype.silent=function(t){return this._silentLogging=!!t,this},u.prototype.tags=function(t,n){var r=u.trailingFunctionArgument(arguments),e=["-l"];u._appendOptions(e,u.trailingOptionsArgument(arguments));var i=e.some((function(t){return/^--sort=/.test(t)}));return this.tag(e,u._responseHandler(r,"TagList",[i]))},u.prototype.rebase=function(t,n){var r=["rebase"];return u._appendOptions(r,u.trailingOptionsArgument(arguments)),r.push.apply(r,u.trailingArrayArgument(arguments)),this._run(r,u._responseHandler(u.trailingFunctionArgument(arguments)))},u.prototype.reset=function(t,n){var r=["reset"],e=u.trailingFunctionArgument(arguments);if(e!==t&&"string"!=typeof t&&t)Array.isArray(t)&&r.push.apply(r,t);else{var i=["mixed","soft","hard"].includes(t)?t:"soft";r.push("--"+i)}return this._run(r,(function(t){e&&e(t||null)}))},u.prototype.revert=function(t,n,r){var e=u.trailingFunctionArgument(arguments),i=["revert"];return u._appendOptions(i,u.trailingOptionsArgument(arguments)),"string"!=typeof t?this.exec((function(){e&&e(new TypeError("Commit must be a string"))})):(i.push(t),this._run(i,(function(t){e&&e(t||null)})))},u.prototype.addTag=function(t,n){return"string"!=typeof t?this.exec((function(){n&&n(new TypeError("Git.addTag requires a tag name"))})):this.tag([t],n)},u.prototype.addAnnotatedTag=function(t,n,r){return this.tag(["-a","-m",n,t],(function(t){r&&r(t)}))},u.prototype.checkout=function(t,n){var r=["checkout"];return r=r.concat(t),this._run(r,(function(t,r){n&&n(t,!t&&this._parseCheckout(r))}))},u.prototype.checkoutBranch=function(t,n,r){return this.checkout(["-b",t,n],r)},u.prototype.checkoutLocalBranch=function(t,n){return this.checkout(["-b",t],n)},u.prototype.deleteLocalBranch=function(t,n){return this.branch(["-d",t],n)},u.prototype.branch=function(t,n){var r,e,i=u.trailingFunctionArgument(arguments),o=["branch"];return o.push.apply(o,u.trailingArrayArgument(arguments)),u._appendOptions(o,u.trailingOptionsArgument(arguments)),arguments.length&&i!==t||o.push("-a"),r=["-d","-D","--delete"].reduce((function(t,n){return t||o.indexOf(n)>0}),!1),0>o.indexOf("-v")&&o.splice(1,0,"-v"),e=r?u._responseHandler(i,"BranchDeleteSummary",!1):u._responseHandler(i,"BranchSummary"),this._run(o,e)},u.prototype.branchLocal=function(t){return this.branch(["-v"],t)},u.prototype.addConfig=function(t,n,r){return this._run(["config","--local",t,n],(function(t,n){r&&r(t,!t&&n)}))},u.prototype.raw=function(t,n){var r=[];Array.isArray(t)?r=t.slice(0):u._appendOptions(r,u.trailingOptionsArgument(arguments));var e=u.trailingFunctionArgument(arguments);return r.length?this._run(r,(function(t,n){e&&e(t,!t&&n||null)})):this.exec((function(){e&&e(new Error("Raw: must supply one or more command to execute"),null)}))},u.prototype.submoduleAdd=function(t,n,r){return this._run(["submodule","add",t,n],(function(t){r&&r(t)}))},u.prototype.submoduleUpdate=function(t,n){"string"==typeof t&&this._getLog("warn","Git#submoduleUpdate: args should be supplied as an array of individual arguments");var r=u.trailingFunctionArgument(arguments),e=t!==r?t:[];return this.subModule(["update"].concat(e),(function(t,n){r&&r(t,n)}))},u.prototype.submoduleInit=function(t,n){"string"==typeof t&&this._getLog("warn","Git#submoduleInit: args should be supplied as an array of individual arguments");var r=u.trailingFunctionArgument(arguments),e=t!==r?t:[];return this.subModule(["init"].concat(e),(function(t,n){r&&r(t,n)}))},u.prototype.subModule=function(t,n){return Array.isArray(t)?("submodule"!==t[0]&&t.unshift("submodule"),this._run(t,(function(t,r){n&&n(t||null,t?null:r)}))):this.exec((function(){n&&n(new TypeError("Git.subModule requires an array of arguments"))}))},u.prototype.listRemote=function(t,n){var r=u.trailingFunctionArgument(arguments),e=r===t||void 0===t?[]:t;return"string"==typeof e&&this._getLog("warn","Git#listRemote: args should be supplied as an array of individual arguments"),this._run(["ls-remote"].concat(e),(function(t,n){r&&r(t,n)}))},u.prototype.addRemote=function(t,n,r){return this._run(["remote","add",t,n],(function(t){r&&r(t)}))},u.prototype.removeRemote=function(t,n){return this._run(["remote","remove",t],(function(t){n&&n(t)}))},u.prototype.getRemotes=function(t,n){var r=u.trailingFunctionArgument(arguments),e=!0===t?["-v"]:[];return this.remote(e,(function(t,n){r&&r(t,!t&&n.trim().split("\n").filter(Boolean).reduce((function(t,n){var r=n.trim().split(/\s+/),e=r.shift();return t[e]||(t[e]=t[t.length]={name:e,refs:{}}),r.length&&(t[e].refs[r.pop().replace(/[^a-z]/g,"")]=r.pop()),t}),[]).slice(0))}))},u.prototype.remote=function(t,n){return Array.isArray(t)?("remote"!==t[0]&&t.unshift("remote"),this._run(t,(function(t,r){n&&n(t||null,t?null:r)}))):this.exec((function(){n&&n(new TypeError("Git.remote requires an array of arguments"))}))},u.prototype.mergeFromTo=function(t,n,r,e){var i=[t,n],o=u.trailingFunctionArgument(arguments);return Array.isArray(r)&&(i=i.concat(r)),this.merge(i,o)},u.prototype.merge=function(t,n){var r=this,e=u.trailingFunctionArgument(arguments)||o,i=function(t,n){if(!t&&n.failed)return u.fail(r,n,e);e(t,n)},s=[];return u._appendOptions(s,u.trailingOptionsArgument(arguments)),s.push.apply(s,u.trailingArrayArgument(arguments)),"merge"!==s[0]&&s.unshift("merge"),1===s.length?this.exec((function(){n&&n(new TypeError("Git.merge requires at least one option"))})):this._run(s,u._responseHandler(i,"MergeSummary"),{concatStdErr:!0})},u.prototype.tag=function(t,n){var r=[];return u._appendOptions(r,u.trailingOptionsArgument(arguments)),r.push.apply(r,u.trailingArrayArgument(arguments)),"tag"!==r[0]&&r.unshift("tag"),this._run(r,u._responseHandler(u.trailingFunctionArgument(arguments)))},u.prototype.updateServerInfo=function(t){return this._run(["update-server-info"],(function(n,r){t&&t(n,!n&&r)}))},u.prototype.push=function(t,n,r){var e=[],i=u.trailingFunctionArgument(arguments);return"string"==typeof t&&"string"==typeof n&&e.push(t,n),Array.isArray(t)&&(e=e.concat(t)),u._appendOptions(e,u.trailingOptionsArgument(arguments)),"push"!==e[0]&&e.unshift("push"),this._run(e,(function(t,n){i&&i(t,!t&&n)}))},u.prototype.pushTags=function(t,n){var r=["push"];return"string"==typeof t&&r.push(t),r.push("--tags"),n="function"==typeof arguments[arguments.length-1]?arguments[arguments.length-1]:null,this._run(r,(function(t,r){n&&n(t,!t&&r)}))},u.prototype.rm=function(t,n){return this._rm(t,"-f",n)},u.prototype.rmKeepLocal=function(t,n){return this._rm(t,"--cached",n)},u.prototype.catFile=function(t,n){return this._catFile("utf-8",arguments)},u.prototype.binaryCatFile=function(t,n){return this._catFile("buffer",arguments)},u.prototype._catFile=function(t,n){var r=u.trailingFunctionArgument(n),e=["cat-file"],i=n[0];if("string"==typeof i)throw new TypeError("Git#catFile: options must be supplied as an array of strings");return Array.isArray(i)&&e.push.apply(e,i),this._run(e,(function(t,n){r&&r(t,n)}),{format:t})},u.prototype.diff=function(t,n){var r=["diff"];return"string"==typeof t?(r[0]+=" "+t,this._getLog("warn","Git#diff: supplying options as a single string is now deprecated, switch to an array of strings")):Array.isArray(t)&&r.push.apply(r,t),"function"==typeof arguments[arguments.length-1]&&(n=arguments[arguments.length-1]),this._run(r,(function(t,r){n&&n(t,r)}))},u.prototype.diffSummary=function(t,n){var r=u.trailingFunctionArgument(arguments),e=["--stat=4096"];return t&&t!==r&&e.push.apply(e,[].concat(t)),this.diff(e,u._responseHandler(r,"DiffSummary"))},u.prototype.revparse=function(t,n){var r=["rev-parse"];return"string"==typeof t?(r=r+" "+t,this._getLog("warn","Git#revparse: supplying options as a single string is now deprecated, switch to an array of strings")):Array.isArray(t)&&r.push.apply(r,t),"function"==typeof arguments[arguments.length-1]&&(n=arguments[arguments.length-1]),this._run(r,(function(t,r){n&&n(t,t?null:String(r).trim())}))},u.prototype.show=function(t,n){var r=[].slice.call(arguments,0),e="function"==typeof r[r.length-1]?r.pop():null,i=["show"];return"string"==typeof t?(i=i+" "+t,this._getLog("warn","Git#show: supplying options as a single string is now deprecated, switch to an array of strings")):Array.isArray(t)&&i.push.apply(i,t),this._run(i,(function(t,n){e&&e(t,!t&&n)}))},u.prototype.clean=function(t,n,r){var e=u.trailingFunctionArgument(arguments);if("string"!=typeof t||!/[nf]/.test(t))return this.exec((function(){e&&e(new TypeError('Git clean mode parameter ("n" or "f") is required'))}));if(/[^dfinqxX]/.test(t))return this.exec((function(){e&&e(new TypeError("Git clean unknown option found in "+JSON.stringify(t)))}));var i=["clean","-"+t];return Array.isArray(n)&&(i=i.concat(n)),i.some(o)?this.exec((function(){e&&e(new TypeError("Git clean interactive mode is not supported"))})):this._run(i,(function(t,n){e&&e(t,!t&&n)}));function o(t){return/^-[^\-]/.test(t)?t.indexOf("i")>0:"--interactive"===t}},u.prototype.exec=function(t){return this._run([],(function(){"function"==typeof t&&t()})),this},u.prototype.then=function(t){return this._getLog("error","\nGit#then is deprecated after version 1.72 and will be removed in version 2.x\nTo use promises switch to importing 'simple-git/promise'."),this.exec(t)},u.prototype.log=function(t,n){var r=u.trailingFunctionArgument(arguments),e=(r===n?t:null)||{},i=e.splitter||a("ListLogSummary").SPLITTER,o=e.format||{hash:"%H",date:"%ai",message:"%s",refs:"%D",body:e.multiLine?"%B":"%b",author_name:"%aN",author_email:"%ae"},s=!1!==e.symmetric?"...":"..",c=Object.keys(o),p=c.map((function(t){return o[t]})).join(i),l=[],f=["log","--pretty=format:"+a("ListLogSummary").START_BOUNDARY+p+a("ListLogSummary").COMMIT_BOUNDARY];return Array.isArray(e)?(f=f.concat(e),e={}):"string"!=typeof arguments[0]&&"string"!=typeof arguments[1]||(this._getLog("warn","Git#log: supplying to or from as strings is now deprecated, switch to an options configuration object"),e={from:arguments[0],to:arguments[1]}),(e.n||e["max-count"])&&f.push("--max-count="+(e.n||e["max-count"])),e.from&&e.to&&f.push(e.from+s+e.to),e.file&&l.push("--follow",t.file),"splitter n max-count file from to --pretty format symmetric multiLine".split(" ").forEach((function(t){delete e[t]})),u._appendOptions(f,e),this._run(f.concat(l),u._responseHandler(r,"ListLogSummary",[i,c]))},u.prototype.clearQueue=function(){return this._runCache.length=0,this},u.prototype.checkIgnore=function(t,n){var r=u.trailingFunctionArgument(arguments),e=["check-ignore"];return r!==t&&(e=e.concat(t)),this._run(e,(function(t,n){r&&r(t,!t&&this._parseCheckIgnore(n))}))},u.prototype.checkIsRepo=function(t){return this._run(["rev-parse","--is-inside-work-tree"],(function(n,r){t&&t(n,"true"===String(r).trim())}),{onError:function(t,n,r,e){if(128===t&&/(Not a git repository|Kein Git-Repository)/i.test(n))return r(!1);e(n)}})},u.prototype._rm=function(t,n,r){var e=[].concat(t),i=["rm",n];return i.push.apply(i,e),this._run(i,(function(t){r&&r(t)}))},u.prototype._parseCheckout=function(t){},u.prototype._parseCheckIgnore=function(t){return t.split(/\n/g).filter(Boolean).map((function(t){return t.trim()}))},u.prototype._run=function(t,n,r){return"string"==typeof t&&(t=t.split(" ")),this._runCache.push([t,n,r||{}]),this._schedule(),this},u.prototype._schedule=function(){if(!this._childProcess&&this._runCache.length){var t=this,r=t.Buffer,i=t._runCache.shift(),o=i[0],s=i[1],a=i[2];n(o);var c=e(),p=!1,l=function t(n){(p||h.length||f.length)&&(c.resolve(n),p=!0),p||(p=!0,setTimeout(t.bind(this,n),50))},f=[],h=[],g=t.ChildProcess.spawn(t._command,o.slice(0),{cwd:t._baseDir,env:t._env,windowsHide:!0});g.stdout.on("data",(function(t){f.push(t)})),g.stderr.on("data",(function(t){h.push(t)})),g.on("error",(function(t){h.push(r.from(t.stack,"ascii"))})),g.on("close",l),g.on("exit",l),c.promise.then((function(n){function e(n){s.call(t,null,n)}function i(n){u.fail(t,n,s)}if(delete t._childProcess,n&&h.length&&a.onError)a.onError(n,r.concat(h).toString("utf-8"),e,i);else if(n&&h.length)i(r.concat(h).toString("utf-8"));else{a.concatStdErr&&[].push.apply(f,h);var o=r.concat(f);"buffer"!==a.format&&(o=o.toString(a.format||"utf-8")),e(o)}process.nextTick(t._schedule.bind(t))})),t._childProcess=g,t._outputHandler&&t._outputHandler(o[0],t._childProcess.stdout,t._childProcess.stderr)}},u.fail=function(t,n,r){t._getLog("error",n),t._runCache.length=0,"function"==typeof r&&r.call(t,n,null)},u.trailingFunctionArgument=function(t){var n=t[t.length-1];return"function"==typeof n?n:null},u.trailingOptionsArgument=function(t){var n=t[t.length-(u.trailingFunctionArgument(t)?2:1)];return"[object Object]"===Object.prototype.toString.call(n)?n:null},u.trailingArrayArgument=function(t){var n=t[t.length-(u.trailingFunctionArgument(t)?2:1)];return"[object Array]"===Object.prototype.toString.call(n)?n:[]},u._appendOptions=function(t,n){null!==n&&Object.keys(n).forEach((function(r){var e=n[r];"string"==typeof e?t.push(r+"="+e):t.push(r)}))},u._responseHandler=function(t,n,r){return function(e,i){if("function"==typeof t){if(e)return t(e,null);if(!n)return t(null,i);var o=a(n),s=o.parse.apply(o,[i].concat(void 0===r?[]:r));t(null,s)}}},u.exception=function(t,n,r){t._runCache.length=0,"function"==typeof r&&r(n instanceof Error?n:new Error(n)),t._getLog("error",n)},t.exports=u}()},function(t,n){t.exports=require("debug")},function(t,n,r){var e=r(9);function i(t,n,r){try{var i=!1,o=e.statSync(t);return(i=i||n&&o.isFile())||r&&o.isDirectory()}catch(t){if("ENOENT"===t.code)return!1;throw t}}t.exports=function(t,n){return n?i(t,1&n,2&n):i(t,!0,!0)},t.exports.FILE=1,t.exports.FOLDER=2},function(t,n){function r(){this.files=[],this.insertions=0,this.deletions=0,this.changed=0}function e(t,n){if(t=t.trim().match(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/)){var r=(t[3]||"").trim();return n.push({file:t[1].trim(),changes:parseInt(t[2],10),insertions:r.replace(/-/g,"").length,deletions:r.replace(/\+/g,"").length,binary:!1}),!0}}function i(t,n){if(t=t.match(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)$/))return n.push({file:t[1].trim(),before:+t[2],after:+t[3],binary:!0}),!0}t.exports=r,r.prototype.insertions=0,r.prototype.deletions=0,r.prototype.changed=0,r.parse=function(t){var n,o=t.trim().split("\n"),s=new r,u=o.pop();for(u&&u.trim().split(", ").forEach((function(t){var n=/(\d+)\s([a-z]+)/.exec(t);n&&(/files?/.test(n[2])?s.changed=parseInt(n[1],10):s[n[2].replace(/s$/,"")+"s"]=parseInt(n[1],10))}));n=o.shift();)e(n,s.files)||i(n,s.files);return s}},function(t,n,r){function e(t,n,r){if(this.path=t,this.index=n,this.working_dir=r,"R"===n+r){var i=e.fromPathRegex.exec(t)||[null,t,t];this.from=i[1],this.path=i[2]}}e.fromPathRegex=/^(.+) -> (.+)$/,e.prototype={path:"",from:""},t.exports=e},function(t,n){function r(){this.files=[],this.insertions={},this.deletions={},this.summary={changes:0,insertions:0,deletions:0},this.created=[],this.deleted=[]}function e(t,n){var e=r.FILE_UPDATE_REGEX.exec(n);if(!e)return!1;t.files.push(e[1]);var i=e[2].length;i&&(t.insertions[e[1]]=i);var o=e[3].length;return o&&(t.deletions[e[1]]=o),!0}function i(t,n){if(!t.files.length)return!1;var e=r.SUMMARY_REGEX.exec(n);return!(!e||void 0===e[3]&&void 0===e[5]||(t.summary.changes=+e[1]||0,t.summary.insertions=+e[3]||0,t.summary.deletions=+e[5]||0,0))}function o(t,n){var e=r.ACTION_REGEX.exec(n);if(!e)return!1;var i=e[2];return 0>t.files.indexOf(i)&&t.files.push(i),("create"===e[1]?t.created:t.deleted).push(i),!0}t.exports=r,r.prototype.created=null,r.prototype.deleted=null,r.prototype.files=null,r.prototype.insertions=null,r.prototype.deletions=null,r.prototype.summary=null,r.FILE_UPDATE_REGEX=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,r.SUMMARY_REGEX=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,r.ACTION_REGEX=/(create|delete) mode \d+ (.+)/,r.parse=function(t){for(var n=new r,s=t.split("\n");s.length;){var u=s.shift().trim();u&&(e(n,u)||i(n,u)||o(n,u))}return n}},function(t,n,r){if("undefined"==typeof Promise)throw new ReferenceError("Promise wrappers must be enabled to use the promise API");function e(t){return t instanceof Error?t:"string"==typeof t?new Error(t):Object.create(new Error(t),{git:{value:t}})}t.exports=function(t){var n,i=r(0),o=r(20),s=Promise.resolve();try{n=o(t)}catch(t){s=Promise.reject(t)}return Object.keys(i.prototype).reduce((function(t,r){return/^_|then/.test(r)?t:(function(t){return/^[^)]+then\s*\)/.test(t)||/\._run\(/.test(t)}(i.prototype[r])?t[r]=n?function(t,n){return function(){var r=[].slice.call(arguments);if("function"==typeof r[r.length])throw new TypeError("Promise interface requires that handlers are not supplied inline, trailing function not allowed in call to "+t);return s.then((function(){return new Promise((function(i,o){r.push((function(t,n){if(t)return o(e(t));i(n)})),n[t].apply(n,r)}))}))}}(r,n):function(){return s}:t[r]=n?function(t,n,r){return function(){return n[t].apply(n,arguments),r}}(r,n,t):function(){return t},t)}),{})}},function(t,n,r){r.r(n);var e=r(6),i=r.n(e);const o=r(1)("git-flush");n.default=async(t="Commit from script",n={})=>{var r;const e={directory:"",push:!1,pull:!0,...n},s=i()(e.directory);if(o(`Directory: ${e.directory}`),!await s.checkIsRepo())return null;const u=await s.status(),a=(null===(r=u.files)||void 0===r?void 0:r.length)||0;return 0===a?(o("0 changes"),0):(o(`Changes: ${u.files.map(t=>t.path).join(", ")}`),e.pull&&await s.raw(["pull"]),await s.add("--all"),await s.commit(t,"--all"),e.push&&await s.push(),o(`Return ${a}`),a)}},function(t,n){t.exports=function(){var t={};return t.promise=new Promise((function(n,r){t.resolve=n,t.reject=r})),t}},function(t,n){t.exports=require("fs")},function(t,n,r){t.exports={BranchDeleteSummary:r(11),BranchSummary:r(12),CommitSummary:r(13),DiffSummary:r(3),FetchSummary:r(14),FileStatusSummary:r(4),ListLogSummary:r(15),MergeSummary:r(16),MoveSummary:r(17),PullSummary:r(5),StatusSummary:r(18),TagList:r(19)}},function(t,n){function r(t,n){this.branch=t,this.hash=n,this.success=null!==n}t.exports=r,r.deleteSuccessRegex=/(\S+)\s+\(\S+\s([^\)]+)\)/,r.deleteErrorRegex=/^error[^']+'([^']+)'/,r.parse=function(t,n){var e,i=t.trim().split("\n").map((function(t){return(e=r.deleteSuccessRegex.exec(t))?new r(e[1],e[2]):(e=r.deleteErrorRegex.exec(t))?new r(e[1],null):void 0})).filter(Boolean);return n?i:i.pop()}},function(t,n){function r(){this.detached=!1,this.current="",this.all=[],this.branches={}}t.exports=r,r.prototype.push=function(t,n,r,e,i){t&&(this.detached=n,this.current=r),this.all.push(r),this.branches[r]={current:t,name:r,commit:e,label:i}},r.detachedRegex=/^(\*?\s+)\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,r.branchRegex=/^(\*?\s+)(\S+)\s+([a-z0-9]+)\s(.*)$/,r.parse=function(t){var n=new r;return t.split("\n").forEach((function(t){var e=!0,i=r.detachedRegex.exec(t);i||(e=!1,i=r.branchRegex.exec(t)),i&&n.push("*"===i[1].charAt(0),e,i[2],i[3],i[4])})),n}},function(t,n){function r(){this.branch="",this.commit="",this.summary={changes:0,insertions:0,deletions:0},this.author=null}t.exports=r;var e=/\[([^\s]+) ([^\]]+)/,i=/\s*Author:\s(.+)/i;r.parse=function(t){var n=t.trim().split("\n"),o=new r;return function(t,n){n&&(t.branch=n[1],t.commit=n[2])}(o,e.exec(n.shift())),i.test(n[0])&&function(t,n){var r=n[1].split("<"),e=r.pop();e.indexOf("@")>0&&(t.author={email:e.substr(0,e.length-1),name:r.join("<").trim()})}(o,i.exec(n.shift())),function(t,n){t.branch&&n&&(t.summary.changes=n[1]||0,t.summary.insertions=n[2]||0,t.summary.deletions=n[3]||0)}(o,/(\d+)[^,]*(?:,\s*(\d+)[^,]*)?(?:,\s*(\d+))?/g.exec(n.shift())),o}},function(t,n,r){function e(t){this.raw=t,this.remote=null,this.branches=[],this.tags=[]}e.parsers=[[/From (.+)$/,function(t,n){t.remote=n[0]}],[/\* \[new branch\]\s+(\S+)\s*\-> (.+)$/,function(t,n){t.branches.push({name:n[0],tracking:n[1]})}],[/\* \[new tag\]\s+(\S+)\s*\-> (.+)$/,function(t,n){t.tags.push({name:n[0],tracking:n[1]})}]],e.parse=function(t){var n=new e(t);return String(t).trim().split("\n").forEach((function(t){var r=t.trim();e.parsers.some((function(t){var e=t[0].exec(r);if(e)return t[1](n,e.slice(1)),!0}))})),n},t.exports=e},function(t,n,r){t.exports=i;var e=r(3);function i(t){this.all=t,this.latest=t.length&&t[0]||null,this.total=t.length}function o(t,n){for(var r=0;r<n.length;r++)this[n[r]]=t[r]||""}i.prototype.all=null,i.prototype.latest=null,i.prototype.total=0,o.prototype.diff=null,i.START_BOUNDARY="òòòòòò ",i.COMMIT_BOUNDARY=" òò",i.SPLITTER=" ò ",i.parse=function(t,n,r){return r=r||["hash","date","message","refs","author_name","author_email"],new i(t.trim().split(i.START_BOUNDARY).filter((function(t){return!!t.trim()})).map((function(t){var s=t.trim().split(i.COMMIT_BOUNDARY),u=new o(s[0].trim().split(n),r);return s.length>1&&s[1].trim()&&(u.diff=e.parse(s[1])),u})))}},function(t,n,r){t.exports=o;var e=r(5);function i(t,n){this.reason=t,this.file=n}function o(){e.call(this),this.conflicts=[],this.merges=[]}i.prototype.toString=function(){return this.file+":"+this.reason},o.prototype=Object.create(e.prototype),o.prototype.result="success",o.prototype.toString=function(){return this.conflicts.length?"CONFLICTS: "+this.conflicts.join(", "):"OK"},Object.defineProperty(o.prototype,"failed",{get:function(){return this.conflicts.length>0}}),o.parsers=[{test:/^Auto-merging\s+(.+)$/,handle:function(t,n){n.merges.push(t[1])}},{test:/^CONFLICT\s+\((.+)\).+ in (.+)$/,handle:function(t,n){n.conflicts.push(new i(t[1],t[2]))}},{test:/^Automatic merge failed;\s+(.+)$/,handle:function(t,n){n.reason=n.result=t[1]}}],o.parse=function(t){let n=new o;t.trim().split("\n").forEach((function(t){for(var r=0,e=o.parsers.length;e>r;r++){let e=o.parsers[r];var i=e.test.exec(t);if(i){e.handle(i,n);break}}}));let r=e.parse(t);return r.summary.changes&&Object.assign(n,r),n}},function(t,n){function r(){this.moves=[],this.sources={}}t.exports=r,r.SUMMARY_REGEX=/^Renaming (.+) to (.+)$/,r.parse=function(t){for(var n,e=t.split("\n"),i=new r,o=0,s=e.length;s>o;o++)(n=r.SUMMARY_REGEX.exec(e[o].trim()))&&i.moves.push({from:n[1],to:n[2]});return i}},function(t,n,r){var e=r(4);function i(){this.not_added=[],this.conflicted=[],this.created=[],this.deleted=[],this.modified=[],this.renamed=[],this.files=[],this.staged=[]}function o(t){var n=t.trim().match(/(..?)(\s+)(.*)/);if(n&&n[1].trim()||(n=t.trim().match(/(..?)\s+(.*)/)),n){var r=n[1];return n[2].length>1&&(r+=" "),1===r.length&&1===n[2].length&&(r=" "+r),{raw:r,code:r.trim(),index:r.charAt(0),workingDir:r.charAt(1),handler:i.parsers[r.trim()],path:n[3]}}}t.exports=i,i.prototype.ahead=0,i.prototype.behind=0,i.prototype.current=null,i.prototype.tracking=null,i.prototype.files=null,i.prototype.isClean=function(){return 0===Object.keys(this).filter((function(t){return Array.isArray(this[t])&&this[t].length}),this).length},i.parsers={"##":function(t,n){var r;r=/ahead (\d+)/.exec(t),n.ahead=r&&+r[1]||0,r=/behind (\d+)/.exec(t),n.behind=r&&+r[1]||0,r=/^(.+?(?=(?:\.{3}|\s|$)))/.exec(t),n.current=r&&r[1],r=/\.{3}(\S*)/.exec(t),n.tracking=r&&r[1]},"??":function(t,n){n.not_added.push(t)},A:function(t,n){n.created.push(t)},AM:function(t,n){n.created.push(t)},D:function(t,n){n.deleted.push(t)},M:function(t,n,r){n.modified.push(t),"M"===r&&n.staged.push(t)},R:function(t,n){var r=/^(.+) -> (.+)$/.exec(t)||[null,t,t];n.renamed.push({from:r[1],to:r[2]})},UU:function(t,n){n.conflicted.push(t)}},i.parsers.MM=i.parsers.M,i.parse=function(t){for(var n,r,s=t.trim().split("\n"),u=new i;r=s.shift();)(n=o(r))&&(n.handler&&n.handler(n.path,u,n.index,n.workingDir),"##"!==n.code&&u.files.push(new e(n.path,n.index,n.workingDir)));return u}},function(t,n){function r(t,n){this.latest=n,this.all=t}t.exports=r,r.parse=function(t,n){var e=function(t){return"string"==typeof t&&parseInt(t.replace(/^\D+/g,""),10)||0},i=t.trim().split("\n").map((function(t){return t.trim()})).filter(Boolean);n||i.sort((function(t,n){var r=t.split("."),i=n.split(".");if(1===r.length||1===i.length)return t-n>0?1:-1;for(var o=0,s=Math.max(r.length,i.length);s>o;o++){var u=e(r[o])-e(i[o]);if(u)return u>0?1:-1}return 0}));var o=n?i[0]:i.filter((function(t){return t.indexOf(".")>=0})).pop();return new r(i,o)}},function(t,n,r){var e=r(0);t.exports=function(t){var n=r(21);if(t&&!n.exists(t,n.exists.FOLDER))throw new Error("Cannot use simple-git on a directory that does not exist.");return new e(t||process.cwd(),n.childProcess(),n.buffer())}},function(t,n,r){t.exports={buffer:function(){return r(22).Buffer},childProcess:function(){return r(23)},exists:r(2)}},function(t,n){t.exports=require("buffer")},function(t,n){t.exports=require("child_process")}])},"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports["git-flush"]=n():t.gitFlush=n();