lib/git.js
async function resolveCommit(dir, ref) {
  return git.resolveRef({ dir, ref })
    .catch(async (err) => {
      if (err.code === 'ResolveRefError') {
        // fallback: is ref a shortened oid prefix?
        const oid = await git.expandOid({ dir, oid: ref }).catch(() => { throw err; });
        return git.resolveRef({ dir, ref: oid });
      }
      // re-throw
      throw err;
    });
}
async function resolveCommit(dir, ref) {
  return git.resolveRef({ dir, ref })
    .catch(async (err) => {
      if (err.code === 'ResolveRefError') {
        // fallback: is ref a shortened oid prefix?
        const oid = await git.expandOid({ dir, oid: ref }).catch(() => { throw err; });
        return git.resolveRef({ dir, ref: oid });
      }
      // re-throw
      throw err;
    });
}
async function resolveCommit ( dir , ref ) { return git . resolveRef ( { dir , ref } ) . catch ( async ( err ) => { if ( err . code === 'ResolveRefError' ) { // fallback: is ref a shortened oid prefix? const oid = await git . expandOid ( { dir , oid : ref } ) . catch ( ( ) => { throw err ; } ) ; return git . resolveRef ( { dir , ref : oid } ) ; } // re-throw throw err ; } ) ; }
Returns the commit oid of the curent commit referenced by `ref`

@param {string} dir git repo path
@param {string} ref reference (branch, tag or commit sha)
@returns {Promise<string>} commit oid of the curent commit referenced by `ref`
@throws {GitError} `err.code === 'ResolveRefError'`: invalid reference
Returns the commit oid of the curent commit referenced by ref