Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2ed3334

Browse files
committed
Fix order of environment setup and git module import
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.
1 parent 27de867 commit 2ed3334

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

fuzzing/fuzz-targets/fuzz_submodule.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import os
44
import tempfile
55
from configparser import ParsingError
6-
from git import Repo, GitCommandError, InvalidGitRepositoryError
76
from utils import (
87
setup_git_environment,
98
handle_exception,
@@ -12,6 +11,7 @@
1211

1312
# Setup the git environment
1413
setup_git_environment()
14+
from git import Repo, GitCommandError, InvalidGitRepositoryError
1515

1616

1717
def TestOneInput(data):

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ lint.unfixable = [
7878
"test/**" = [
7979
"B018", # useless-expression
8080
]
81+
"fuzzing/fuzz-targets/**" = [
82+
"E402", # environment setup must happen before the `git` module is imported, thus cannot happen at top of file
83+
]
84+
8185

8286
[tool.codespell]
8387
ignore-words-list="gud,doesnt"

0 commit comments

Comments
 (0)