Skip to content

Commit

Permalink
Fix order of environment setup and git module import
Browse files Browse the repository at this point in the history
The environment setup must happen before the `git` module is imported,
otherwise GitPython won't be able to find the Git executable and raise
an exception that causes the ClusterFuzz fuzzer runs to fail.
  • Loading branch information
DaveLak committed Aug 9, 2024
1 parent 27de867 commit 2ed3334
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fuzzing/fuzz-targets/fuzz_submodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import os
import tempfile
from configparser import ParsingError
from git import Repo, GitCommandError, InvalidGitRepositoryError
from utils import (
setup_git_environment,
handle_exception,
Expand All @@ -12,6 +11,7 @@

# Setup the git environment
setup_git_environment()
from git import Repo, GitCommandError, InvalidGitRepositoryError


def TestOneInput(data):
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ lint.unfixable = [
"test/**" = [
"B018", # useless-expression
]
"fuzzing/fuzz-targets/**" = [
"E402", # environment setup must happen before the `git` module is imported, thus cannot happen at top of file
]


[tool.codespell]
ignore-words-list="gud,doesnt"
Expand Down

0 comments on commit 2ed3334

Please sign in to comment.