MCPcopy Index your code
hub / github.com/nodegit/nodegit / createAndCommitFiles

Function createAndCommitFiles

test/tests/stage.js:276–290  ·  view source on GitHub ↗
(repo, filePaths, fileContent, afterWriteFn)

Source from the content-addressed store, hash-verified

274 }
275
276 function createAndCommitFiles(repo, filePaths, fileContent, afterWriteFn) {
277 filePaths = filePaths instanceof Array ? filePaths : [filePaths];
278 var filePromises = filePaths.map(function(fileName) {
279 return RepoUtils.commitFileToRepo(repo, fileName, fileContent)
280 .then(function() {
281 //First, create a file, have the same file in both the repo and workdir.
282 return fse.writeFile(path.join(repo.workdir(), fileName), fileContent);
283 })
284 .then(function() {
285 return afterWriteFn(repo, fileName);
286 });
287 });
288
289 return Promise.all(filePromises);
290 }
291
292 if (process.platform == "linux" || process.platform == "darwin") {
293 it("can stage filemode changes for one file", function() {

Callers 1

stage.jsFile · 0.85

Calls 1

afterWriteFnFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…