How to use the isomorphic-git.commit function in isomorphic-git

To help you get started, weโ€™ve selected a few isomorphic-git examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mizchi / next-editor / src / domain / git / commands / commitAll.ts View on Github external
const mat = await git.statusMatrix({ dir: root })
  const modified = Parser.getModifiedFilenames(mat)
  const removable = Parser.getRemovableFilenames(mat)

  for (const filepath of modified) {
    if (removable.includes(filepath)) {
      await git.remove({ dir: root, filepath })
    } else {
      // TODO: Why?????
      if (filepath) {
        await git.add({ dir: root, filepath })
      }
    }
  }

  return git.commit({
    dir: root,
    message,
    author
  })
}
github mizchi / next-editor / src / domain / git / commands / setupInitialRepository.ts View on Github external
// Pass
  } else {
    await git.init({ dir: projectRoot })
    await git.add({
      dir: "/playground",
      filepath: "README.md"
    })
    await git.add({
      dir: "/playground",
      filepath: ".gitignore"
    })
    await git.add({
      dir: "/playground",
      filepath: "scratch.md"
    })
    await git.commit({
      author: {
        email: "dummy",
        name: "system"
      },
      dir: "/playground",
      message: "Init"
    })
  }
}
github telstra / openapi-platform / packages / git-util / src / index.ts View on Github external
});

    await migrateSdkIntoLocalRepo(repoDir, remoteSdkUrl, options);
    const addedPaths = await getAllStageableFilepathsInRepo(repoDir);
    logger.verbose(`Staging ${addedPaths.length} paths`);
    for (const addedPath of addedPaths) {
      const relativeFilePath = relative(repoDir, addedPath);
      // TODO: Got a lot of "oldFs: fs", maybe make some sort of wrapper to avoid this?
      await add({
        fs: oldFs,
        dir: repoDir,
        filepath: relativeFilePath,
      });
    }
    logger.verbose(`Committing changes...`);
    await commit({
      fs: oldFs,
      dir: repoDir,
      // TODO: This should be configurable
      author: {
        name: 'Swagger Platform',
        email: 'N/A',
      },
      // TODO: Could have a better message
      message: 'Updated SDK',
    });

    logger.verbose(`Pushing commits...`);
    await push({
      fs: oldFs,
      dir: repoDir,
      ...gitInfo.auth,
github mizchi / next-editor / src / domain / git / __testHelpers__ / helpers.ts View on Github external
export async function batchUpdateFiles(
  projectRoot: string,
  files: Array<[string, string]>,
  message: string = "Update"
): Promise {
  for (const [filename, content] of files) {
    await fs.promises.writeFile(path.join(projectRoot, filename), content)
    await git.add({ dir: projectRoot, filepath: filename })
  }
  return git.commit({
    dir: projectRoot,
    message,
    author: { name: "test", email: "test" }
  })
}
github casual-simulation / aux / WebClient / GitManager.ts View on Github external
async commit(message: string): Promise {
        console.log(`[GitManager] Committing...`);
        const sha = await commit({
            dir: this.projectDir,
            message: message,
            author: {
                email: this.email,
                name: this.username
            }
        });
        console.log(`[GitManager] Committed ${sha}.`);
    }
github mizchi / next-editor / src / domain / git / commands / createProject.ts View on Github external
export async function createProject(newProjectRoot: string): Promise {
  await mkdir(newProjectRoot)
  await git.init({ dir: newProjectRoot })
  const outpath = path.join(newProjectRoot, "README.md")
  await writeFile(outpath, "# New Project")
  await git.add({ dir: newProjectRoot, filepath: "README.md" })
  await git.commit({
    dir: newProjectRoot,
    author: { name: "system", email: "dummy" },
    message: "Init"
  })
}
github mizchi / next-editor / src / lib / repository.ts View on Github external
export function commitChanges(
  projectRoot: string,
  message: string = "Update",
  author?: { name: string; email: string }
): Promise {
  return git.commit({
    author: author || {
      email: "dummy",
      name: "anonymous"
    },
    dir: projectRoot,
    fs,
    message
  })
}
github nteract / nteract / applications / desktop / src / notebook / epics / git.js View on Github external
const filepath = content.filepath;
      const notificationSystem = selectors.notificationSystem(state);
      const repo = {
        fs,
        dir: filepath.substring(0, filepath.lastIndexOf("/"))
      };
      const response = remote.dialog.showMessageBox({
        type: "question",
        buttons: ["Yes", "No"],
        title: "Confirm",
        message: "Commit changes?"
      });

      if (response == 0) {
        return from(
          git.commit({ ...repo, message: "chore: updating notebook" })
        ).pipe(
          map(
            () =>
              actions.gitCommitSuccessful({
                contentRef: action.payload.contentRef
              }),
            notificationSystem.addNotification({
              title: "Changes Commited",
              message: `Notebook changes have been commited.`,
              dismissible: true,
              position: "tr",
              level: "success"
            })
          ),
          catchError(err => actions.gitCommitFailed(err))
        );
github mizchi / next-editor / src / domain / git / commands / commitChanges.ts View on Github external
export function commitChanges(
  projectRoot: string,
  message: string = "Update",
  author: { name: string; email: string }
): Promise {
  return git.commit({
    author,
    dir: projectRoot,
    message
  })
}
github felipemanga / FemtoIDE / plugins / git.js View on Github external
function gitCommit( message ){
        git.commit({
            dir,
            message,
            author:{
                name:DATA.name,
                email:DATA.email
            }
        }).then(sha=>{
            log("Committed: " + sha);
            APP.gitRefresh();
        }).catch(ex=>{
            APP.error("Could not commit: ", ex);
        });
    }