resolveRelativeGitDir = async (cwd) => {
  /**
   * Absolute repo top-level directory
   *
   * @example <caption>Git on macOS</caption>
   * "/Users/iiro/Documents/git/lint-staged"
   *
   * @example <caption>Git for Windows</caption>
   * "C:\Users\iiro\Documents\git\lint-staged"
   *
   * @example <caption>Git installed with MSYS2, this doesn't work when used as CWD with Node.js child_process</caption>
   * "/c/Users/iiro/Documents/git/lint-staged"
   */
  const topLevelPromise = execGit(['rev-parse', '--show-toplevel'], { cwd })

  /**
   * Absolute .git directory, similar to top-level
   *
   * @example "/Users/iiro/Documents/git/lint-staged/.git"
   */
  const absoluteGitDirPromise = execGit(['rev-parse', '--absolute-git-dir'], { cwd })

  const [topLevel, absoluteGitDir] = await Promise.all([topLevelPromise, absoluteGitDirPromise])

  return path.relative(topLevel, absoluteGitDir)
}
Resolve .git directory relative to repo top-level directory

@example ".git"