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 28, 2022
1 parent 68e7815 commit e8e4c5c
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 @@ -76,6 +76,16 @@ def git_rev_parse(revision: str, cwd: Path) -> str:
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
: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_is_repository(path: Path) -> bool:
"""Return ``True`` if ``path`` is inside a Git working tree"""
try:
Expand Down

0 comments on commit e8e4c5c

Please sign in to comment.