Skip to content

Commit

Permalink
chore: add deep clone in test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Goldziher committed Jul 18, 2024
1 parent 37c01ad commit 37f7de4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# we need the entire history here because we use commits from the past for testing.
fetch-depth: 0
- uses: pdm-project/setup-pdm@v4
with:
python-version: '3.9'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
.pdm-build/
.pdm-python
.pdm.toml
.python-version
.tox/
.venv/
.vscode/
Expand Down
13 changes: 8 additions & 5 deletions gitmind/utils/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,18 @@ def get_commit(*, repo: Repository, commit_hex: str) -> Commit:
commit_hex: The SHA hex of the commit to retrieve.
Raises:
ValueError: If the object with the given SHA is not a commit.
ValueError: If the object with the given SHA is not a commit or if the commit is not found.
Returns:
The commit object.
"""
git_object = repo.revparse_single(commit_hex)
if isinstance(git_object, Commit):
return git_object
raise ValueError(f"GIT object with SHA hex {commit_hex} is not a commit.")
try:
git_object = repo.revparse_single(commit_hex)
if isinstance(git_object, Commit):
return git_object
raise ValueError(f"GIT object with SHA hex {commit_hex} is not a commit.")
except KeyError as e:
raise ValueError(f"Commit with SHA hex {commit_hex} not found.") from e


def extract_commit_data(*, repo: Repository, commit_hex: str) -> tuple[CommitStatistics, CommitMetadata, str]:
Expand Down

0 comments on commit 37f7de4

Please sign in to comment.