def parse_git_config (): """Return a dict containing the parsed version of 'git config -l'.""" exit_code, output, errors = run_command(("git", "config", "-z", "-l")) if exit_code: die("Failed to retrieve git configuration") assert not errors return dict([e.split('\n', 1) for e in output.split("\0") if e])
def get_git_dir (): """Return the path to the GIT_DIR for this repo.""" args = ("git", "rev-parse", "--git-dir") exit_code, output, errors = run_command(args) if exit_code: die("Failed to retrieve git dir") assert not errors return output.strip()