#!/usr/bin/env node
(function webpackUniversalModuleDefinition(root, factory) {
	if(typeof exports === 'object' && typeof module === 'object')
		module.exports = factory();
	else if(typeof define === 'function' && define.amd)
		define([], factory);
	else {
		var a = factory();
		for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
	}
})(global, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = "./src/plugins/git/bin/createExampleRepo.js");
/******/ })
/************************************************************************/
/******/ ({

/***/ "./src/plugins/git/bin/createExampleRepo.js":
/*!**************************************************!*\
  !*** ./src/plugins/git/bin/createExampleRepo.js ***!
  \**************************************************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fs */ \"fs\");\n/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _example_exampleRepo__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../example/exampleRepo */ \"./src/plugins/git/example/exampleRepo.js\");\n/* harmony import */ var _util_null__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../util/null */ \"./src/util/null.js\");\nfunction parseArgs(){const argv=process.argv.slice(2);const fail=()=>{const invocation=process.argv.slice(0,2).join(\" \");throw new Error(\"Usage: \".concat(invocation,\" [--[no-]submodule] TARGET_DIRECTORY\"));};let submodule=false;let target=null;for(const arg of argv){if(arg===\"--submodule\"){submodule=true;}else if(arg===\"--no-submodule\"){submodule=false;}else{if(target==null){target=arg;}else{fail();}}}return{submodule,target:_util_null__WEBPACK_IMPORTED_MODULE_2__[\"get\"](target)};}function ensureEmptyDirectoryOrNonexistent(target){const files=(()=>{try{return fs__WEBPACK_IMPORTED_MODULE_0___default.a.readdirSync(target);}catch(e){if(e.code===\"ENOTDIR\"){throw new Error(\"Target exists, but is not a directory.\");}else if(e.code===\"ENOENT\"){// No problem. We'll create it.\nreturn[];}else{throw e;}}})();if(files.length>0){throw new Error(\"Target directory exists, but is nonempty.\");}}function main(){const args=parseArgs();ensureEmptyDirectoryOrNonexistent(args.target);if(args.submodule){Object(_example_exampleRepo__WEBPACK_IMPORTED_MODULE_1__[\"createExampleSubmoduleRepo\"])(args.target);}else{Object(_example_exampleRepo__WEBPACK_IMPORTED_MODULE_1__[\"createExampleRepo\"])(args.target);}}main();\n\n//# sourceURL=webpack:///./src/plugins/git/bin/createExampleRepo.js?");

/***/ }),

/***/ "./src/plugins/git/example/exampleRepo.js":
/*!************************************************!*\
  !*** ./src/plugins/git/example/exampleRepo.js ***!
  \************************************************/
/*! exports provided: SUBMODULE_REMOTE_URL, SUBMODULE_COMMIT_1, SUBMODULE_COMMIT_2, createExampleRepo, createExampleSubmoduleRepo */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SUBMODULE_REMOTE_URL\", function() { return SUBMODULE_REMOTE_URL; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SUBMODULE_COMMIT_1\", function() { return SUBMODULE_COMMIT_1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SUBMODULE_COMMIT_2\", function() { return SUBMODULE_COMMIT_2; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"createExampleRepo\", function() { return createExampleRepo; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"createExampleSubmoduleRepo\", function() { return createExampleSubmoduleRepo; });\n/* harmony import */ var tmp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tmp */ \"tmp\");\n/* harmony import */ var tmp__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(tmp__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! fs-extra */ \"fs-extra\");\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs_extra__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _gitUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../gitUtils */ \"./src/plugins/git/gitUtils.js\");\n// For determinism, the example repository's submodule URL must be set\n// to a fixed value. We choose the URL of the GitHub mirror (it's as\n// good as any other, and makes sense).\nconst SUBMODULE_REMOTE_URL=\"https://github.com/sourcecred-test/example-git-submodule.git\";// The example repository checks out two different versions of the\n// submodule, as given by the following two hashes. These must exist\n// within the submodule; this property is checked by the test file for\n// this module.\nconst SUBMODULE_COMMIT_1=\"762c062fbdc7ec198cd693e95d55b374a08ff3e3\";const SUBMODULE_COMMIT_2=\"29ef158bc982733e2ba429fcf73e2f7562244188\";/**\n * Create the main example repository.\n */function createExampleRepo(intoDirectory){const repositoryPath=intoDirectory;fs_extra__WEBPACK_IMPORTED_MODULE_1___default.a.mkdirpSync(repositoryPath);const git=Object(_gitUtils__WEBPACK_IMPORTED_MODULE_2__[\"makeUtils\"])(repositoryPath);const commits=[];function commit(message){git.deterministicCommit(message);commits.push(git.head());}git.exec([\"init\"]);git.writeAndStage(\"README.txt\",[\"example-git\\n\",\"-----------\\n\\n\",\"This repository provides example data for the SourceCred Git plugin.\\n\",\"Pay no attention to the contents behind the curtain.\\n\"].join(\"\"));commit(\"Initial commit\");git.writeAndStage(\"science.txt\",\"Amazing physics going on...\\n\");commit(\"Add repository description\");const tmpdir=tmp__WEBPACK_IMPORTED_MODULE_0___default.a.dirSync({unsafeCleanup:true});const submoduleName=\"pygravitydefier\";createExampleSubmoduleRepo(tmpdir.name);git.exec([\"submodule\",\"add\",\"--quiet\",tmpdir.name,submoduleName]);// After cloning the submodule, we don't need it anymore.\ntmpdir.removeCallback();// We need all our commits to be deterministic, which means that the\n// submodule URL needs to be independent of the actual location on\n// disk (which may be, e.g., a temporary directory).\ngit.exec([\"config\",\"--file=.gitmodules\",\"submodule.\".concat(submoduleName,\".url\"),SUBMODULE_REMOTE_URL]);git.exec([\"submodule\",\"sync\",\"--quiet\"]);git.exec([\"add\",\".gitmodules\"]);git.exec([\"-C\",submoduleName,\"checkout\",SUBMODULE_COMMIT_1,\"--quiet\"]);git.exec([\"add\",submoduleName]);commit(\"Add gravity defiance module\");git.writeAndStage(\"src/index.py\",\"import antigravity\\n\");git.writeAndStage(\"src/quantum_gravity.py\",'raise NotImplementedError(\"TODO(physicists)\")\\n');git.writeAndStage(\"TODOS.txt\",\"1. Resolve quantum gravity\\n\");commit(\"Discover gravity\");git.exec([\"-C\",submoduleName,\"checkout\",SUBMODULE_COMMIT_2,\"--quiet\"]);git.exec([\"add\",submoduleName]);commit(\"Pull quantum gravity defiance from upstream\");git.writeAndStage(\"src/quantum_gravity.py\",\"import random\\nif random.random() < 0.5:\\n  import antigravity\\n\");commit(\"Solve quantum gravity\");git.exec([\"rm\",\"TODOS.txt\"]);commit(\"Clean up TODOS\");git.writeAndStage(\"src/whatever.py\",\"import json\\nprint('hello world')\\n\");commit(\"  This | has leading whitespace.\");return{path:repositoryPath,commits};}/**\n * Create the example repository that should be included as a submodule\n * in a larger repository. (This repository does not itself have\n * submodules.)\n */function createExampleSubmoduleRepo(intoDirectory){const repositoryPath=intoDirectory;fs_extra__WEBPACK_IMPORTED_MODULE_1___default.a.mkdirpSync(repositoryPath);const git=Object(_gitUtils__WEBPACK_IMPORTED_MODULE_2__[\"makeUtils\"])(repositoryPath);const commits=[];function commit(message){git.deterministicCommit(message);commits.push(git.head());}git.exec([\"init\"]);git.writeAndStage(\"README.txt\",[\"example-git-submodule\\n\",\"---------------------\\n\\n\",\"This simple repository serves no purpose other than to be included as\\n\",\"a submodule in a larger repository.\\n\"].join(\"\"));commit(\"Initial commit\");git.writeAndStage(\"useless.txt\",\"Nothing to see here; move along.\\n\");commit(\"Add a file, so that we have multiple commits\");return{path:repositoryPath,commits};}\n\n//# sourceURL=webpack:///./src/plugins/git/example/exampleRepo.js?");

/***/ }),

/***/ "./src/plugins/git/gitUtils.js":
/*!*************************************!*\
  !*** ./src/plugins/git/gitUtils.js ***!
  \*************************************/
/*! exports provided: localGit, makeUtils */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"localGit\", function() { return localGit; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"makeUtils\", function() { return makeUtils; });\n/* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! child_process */ \"child_process\");\n/* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! fs-extra */ \"fs-extra\");\n/* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs_extra__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! path */ \"path\");\n/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__);\nfunction ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function localGit(repositoryPath){return function git(args,env){// We standardize the environment variables shown to Git, using\n// Git's test suite [1] as inspiration. It is particularly important\n// that `GIT_DIR` be unset from the parent process environment.\n// Otherwise, these tests have the wrong behavior when running in an\n// `exec` step of a Git rebase.\n//\n// [1]: https://github.com/git/git/blob/1f1cddd558b54bb0ce19c8ace353fd07b758510d/t/test-lib.sh#L90\nconst baseEnv={// Standardize output.\nLANG:\"C\",LC_ALL:\"C\",PAGER:\"cat\",TZ:\"UTC\",// Short-circuit editing.\nEDITOR:\"true\",// (this is `true` the command-line program)\nGIT_MERGE_AUTOEDIT:\"no\",// Ignore global Git settings, for test isolation.\nGIT_CONFIG_NOSYSTEM:\"1\",GIT_ATTR_NOSYSTEM:\"1\",// Bring over the SSH configuration so that loading private repos is possible\n// This post has some useful information on SSH_AUTH_SOCK:\n// http://blog.joncairns.com/2013/12/understanding-ssh-agent-and-ssh-add/\nSSH_AUTH_SOCK:process.env.SSH_AUTH_SOCK};const fullEnv=_objectSpread(_objectSpread({},baseEnv),env||{});const options={env:fullEnv};return Object(child_process__WEBPACK_IMPORTED_MODULE_0__[\"execFileSync\"])(\"git\",[\"-C\",repositoryPath,...args],options).toString();};}function makeUtils(repositoryPath){const git=localGit(repositoryPath);return{exec:git,head(){return git([\"rev-parse\",\"HEAD\"]).trim();},writeAndStage(filename,contents){const filepath=path__WEBPACK_IMPORTED_MODULE_2___default.a.join(repositoryPath,filename);const dirpath=path__WEBPACK_IMPORTED_MODULE_2___default.a.join(repositoryPath,path__WEBPACK_IMPORTED_MODULE_2___default.a.dirname(filename));fs_extra__WEBPACK_IMPORTED_MODULE_1___default.a.mkdirpSync(dirpath);fs_extra__WEBPACK_IMPORTED_MODULE_1___default.a.writeFileSync(filepath,contents);git([\"add\",filename]);},deterministicCommit(message){git([\"-c\",\"user.name=Test Runner\",\"-c\",\"user.email=nobody@example.com\",\"commit\",\"-m\",message],{GIT_AUTHOR_DATE:\"2001-02-03T04:05:06\",GIT_COMMITTER_DATE:\"2002-03-04T05:06:07\"});}};}\n\n//# sourceURL=webpack:///./src/plugins/git/gitUtils.js?");

/***/ }),

/***/ "./src/util/null.js":
/*!**************************!*\
  !*** ./src/util/null.js ***!
  \**************************/
/*! exports provided: map, get, orThrow, orElse, filterList */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"map\", function() { return map; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"get\", function() { return get; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"orThrow\", function() { return orThrow; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"orElse\", function() { return orElse; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"filterList\", function() { return filterList; });\n/**\n * Utilities for working with nullable types: `?T = T | null | void`.\n *\n * These functions use the native runtime representation, as opposed to\n * creating an `Optional<T>` wrapper class. This ensures that they have\n * minimal runtime cost (just a function call), and that they are\n * trivially interoperable with other code.\n *\n * When a value of type `?T` is `null` or `undefined`, we say that it is\n * _absent_. Otherwise, it is _present_.\n *\n * Some functions that typically appear in such libraries are not\n * needed:\n *\n *   - `join` (`??T => ?T`) can be implemented as the identity function,\n *     because the Flow types `??T` and `?T` are equivalent;\n *   - `flatMap` (`?T => (T => ?U) => ?U`) can be implemented simply as\n *     `map`, again because `??T` and `?T` are equivalent;\n *   - `first` (`?T => ?T => ?T`) can be implemented simply as `orElse`,\n *     again because `??T` and `?T` are equivalent;\n *   - `isPresent` (`?T => boolean`) doesn't provide much value over the\n *     equivalent abstract disequality check;\n *   - constructors like `empty` (`() => ?T`) and `of` (`T => ?T`) are\n *     entirely spurious.\n *\n * Other functions could reasonably be implemented, but have been left\n * out because they have rarely been needed:\n *\n *   - `filter` (`?T => (T => boolean) => ?T`);\n *   - `forEach` (`?T => (T => void) => void`);\n *   - `orElseGet` (`?T => (() => T) => T`), which is useful in the case\n *      where constructing the default value is expensive.\n *\n * (Of these three, `orElseGet` would probably be the most useful for\n * our existing codebase.)\n */ /**\n * Apply the given function inside the nullable. If the input is absent,\n * then it will be returned unchanged. Otherwise, the given function\n * will be applied.\n */function map(x,f){return x!=null?f(x):x;}/**\n * Extract the value from a nullable. If the input is present, it will\n * be returned. Otherwise, an error will be thrown with the provided\n * message (defaulting to the string representation of the absent input).\n */function get(x,errorMessage){if(x==null){throw new Error(errorMessage!=null?errorMessage:String(x));}else{return x;}}/**\n * Extract the value from a nullable. If the input is present, it will\n * be returned. Otherwise, an error will be thrown, with message given\n * by the provided function.\n */function orThrow(x,getErrorMessage){if(x==null){throw new Error(getErrorMessage());}else{return x;}}/**\n * Extract the value from a nullable, using the provided default value\n * in case the input is absent.\n */function orElse(x,defaultValue){return x!=null?x:defaultValue;}/**\n * Filter nulls and undefined out of an array, returning a new array.\n *\n * The functionality is easy to implement without a util method (just call\n * `filter`); however Flow doesn't infer the type of the output array based on\n * the callback that was passed to filter. This method basically wraps filter\n * in a type-aware way.\n */function filterList(xs){// A type-safe way to implement this would be:\n/*:: (xs.flatMap((x) => x == null ? [] : [x]): T[]); */ // For performance, we instead take an unsafe route.\nreturn xs.filter(x=>x!=null);}\n\n//# sourceURL=webpack:///./src/util/null.js?");

/***/ }),

/***/ "child_process":
/*!********************************!*\
  !*** external "child_process" ***!
  \********************************/
/*! no static exports found */
/***/ (function(module, exports) {

eval("module.exports = require(\"child_process\");\n\n//# sourceURL=webpack:///external_%22child_process%22?");

/***/ }),

/***/ "fs":
/*!*********************!*\
  !*** external "fs" ***!
  \*********************/
/*! no static exports found */
/***/ (function(module, exports) {

eval("module.exports = require(\"fs\");\n\n//# sourceURL=webpack:///external_%22fs%22?");

/***/ }),

/***/ "fs-extra":
/*!***************************!*\
  !*** external "fs-extra" ***!
  \***************************/
/*! no static exports found */
/***/ (function(module, exports) {

eval("module.exports = require(\"fs-extra\");\n\n//# sourceURL=webpack:///external_%22fs-extra%22?");

/***/ }),

/***/ "path":
/*!***********************!*\
  !*** external "path" ***!
  \***********************/
/*! no static exports found */
/***/ (function(module, exports) {

eval("module.exports = require(\"path\");\n\n//# sourceURL=webpack:///external_%22path%22?");

/***/ }),

/***/ "tmp":
/*!**********************!*\
  !*** external "tmp" ***!
  \**********************/
/*! no static exports found */
/***/ (function(module, exports) {

eval("module.exports = require(\"tmp\");\n\n//# sourceURL=webpack:///external_%22tmp%22?");

/***/ })

/******/ });
});