Josh Steadmon <steadmon@xxxxxxxxxx> writes: > prepare_repo_settings() initializes a `struct repository` with various > default config options and settings read from a repository-local config > file. In 44c7e62 (2021-12-06, repo-settings:prepare_repo_settings only > in git repos), prepare_repo_settings was changed to issue a BUG() if it > is called by a process whose CWD is not a Git repository. This approach > was suggested in [1]. > > This breaks fuzz-commit-graph, which attempts to parse arbitrary > fuzzing-engine-provided bytes as a commit graph file. > commit-graph.c:parse_commit_graph() calls prepare_repo_settings(), but > since we run the fuzz tests without a valid repository, we are hitting > the BUG() from 44c7e62 for every test case. I think the right approach for such a breakage is to ensure it is in a repository, not to force prepare_repo_settings() to lie. In the day-to-day real code paths the end user uses, we do want to catch mistakes in our code that calls prepare_repo_settings() when we are not in a repository.