How to use the isomorphic-git.log 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 / queries / getFileHistory.ts View on Github external
export async function getFileHistory(
  dir: string,
  ref: string,
  filepath: string
): Promise<
  Array<{
    commit: CommitDescription
    blob: GitBlobDescription
  }>
> {
  const commits: CommitDescription[] = await git.log({ dir, ref })
  const rawChanges = await Promise.all(
    commits.map(async commit => {
      try {
        const blob = await git.readObject({
          dir,
          oid: commit.oid,
          filepath
        })
        return {
          commit,
          blob
        }
      } catch (e) {
        return
      }
    })
github mizchi / next-editor / src / domain / git / queries / getHistory.ts View on Github external
export async function getHistory(
  projectRoot: string,
  { depth, ref = "master" }: { depth?: number; ref?: string }
): Promise {
  return git.log({ dir: projectRoot, depth, ref })
}
github mizchi / next-editor / src / domain / git / queries / isFastForward.ts View on Github external
export async function isFastForward(
  dir: string,
  refA: string,
  refB: string
): Promise<
  | {
      fastForward: false
    }
  | {
      fastForward: true
      self: boolean
      commits: CommitDescription[]
    }
> {
  const logA: CommitDescription[] = await git.log({ dir, ref: refA })
  const logB: CommitDescription[] = await git.log({ dir, ref: refB })
  const fastForward: boolean = isFastForwardByCommits(logA, logB)
  if (fastForward) {
    const oid = logA[logA.length - 1].oid
    const index = logB.findIndex(i => i.oid === oid)
    return {
      fastForward: true,
      self: logA[0].oid === logB[0].oid,
      commits: logB.slice(index)
    }
  } else {
    return {
      fastForward: false
    }
  }
}
github felipemanga / FemtoIDE / plugins / git.js View on Github external
gitLog(msg){
            if( !msg ) msg = {depth:10};
            
            log("------ GIT LOG ------");
            log("(Newest entries last)");

            git.log(Object.assign({dir}, msg))
                .then(list=>{
                    list.reverse()
                        .forEach(entry=>{
                            log(entry.message);
                        });
                });
        }
github mizchi / next-editor / src / lib / repository.ts View on Github external
export async function getLogInRepository(
  projectRoot: string,
  { depth, ref = "master" }: { depth?: number; ref?: string }
): Promise {
  return git.log({ fs, dir: projectRoot, depth, ref })
}
github casual-simulation / aux / WebClient / GitManager.ts View on Github external
async commitLog(): Promise {
        return await log({
            dir: this.projectDir
        });
    }