Skip to content

Commit

Permalink
Add git_rev_parse() helper
Browse files Browse the repository at this point in the history
  • Loading branch information
akaihola committed Dec 25, 2022
1 parent 6379342 commit bf381cc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/darker/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@
PRE_COMMIT_FROM_TO_REFS = ":PRE-COMMIT:"


def git_rev_parse(revision: str, cwd: Path) -> str:
"""Return the commit hash for the given revision
:param revision: The revision to get the commit hash for
:param cwd: The root of the Git repository
"""
return _git_check_output_lines(["rev-parse", revision], cwd)[0]


def git_rev_parse(revision: str, cwd: Path) -> str:
"""Return the commit hash for the given revision
Expand Down

0 comments on commit bf381cc

Please sign in to comment.