1919if TYPE_CHECKING :
2020 from typing_extensions import TypeAlias
2121
22+ from libvcs ._internal .run import _ENV
23+
2224
2325class MaxUniqueRepoAttemptsExceeded (exc .LibVCSException ):
2426 """Raised when exceeded threshold of attempts to find a unique repo destination."""
@@ -391,10 +393,17 @@ def fn(
391393 return fn
392394
393395
394- def git_remote_repo_single_commit_post_init (remote_repo_path : pathlib .Path ) -> None :
396+ def git_remote_repo_single_commit_post_init (
397+ remote_repo_path : pathlib .Path ,
398+ env : "_ENV | None" = None ,
399+ ) -> None :
395400 """Post-initialization: Create a test git repo with a single commit."""
396401 testfile_filename = "testfile.test"
397- run (["touch" , testfile_filename ], cwd = remote_repo_path )
402+ run (
403+ ["touch" , testfile_filename ],
404+ cwd = remote_repo_path ,
405+ env = {"GITCONFIG" : str (gitconfig )},
406+ )
398407 run (["git" , "add" , testfile_filename ], cwd = remote_repo_path )
399408 run (["git" , "commit" , "-m" , "test file for dummyrepo" ], cwd = remote_repo_path )
400409
@@ -403,11 +412,17 @@ def git_remote_repo_single_commit_post_init(remote_repo_path: pathlib.Path) -> N
403412@skip_if_git_missing
404413def git_remote_repo (
405414 create_git_remote_repo : CreateRepoPytestFixtureFn ,
415+ gitconfig : pathlib .Path ,
406416) -> pathlib .Path :
407417 """Copy the session-scoped Git repository to a temporary directory."""
408418 # TODO: Cache the effect of of this in a session-based repo
409419 repo_path = create_git_remote_repo ()
410- git_remote_repo_single_commit_post_init (remote_repo_path = repo_path )
420+ git_remote_repo_single_commit_post_init (
421+ remote_repo_path = repo_path ,
422+ env = {
423+ "GITCONFIG" : str (gitconfig ),
424+ },
425+ )
411426 return repo_path
412427
413428
0 commit comments