19
19
if TYPE_CHECKING :
20
20
from typing_extensions import TypeAlias
21
21
22
+ from libvcs ._internal .run import _ENV
23
+
22
24
23
25
class MaxUniqueRepoAttemptsExceeded (exc .LibVCSException ):
24
26
"""Raised when exceeded threshold of attempts to find a unique repo destination."""
@@ -391,10 +393,17 @@ def fn(
391
393
return fn
392
394
393
395
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 :
395
400
"""Post-initialization: Create a test git repo with a single commit."""
396
401
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
+ )
398
407
run (["git" , "add" , testfile_filename ], cwd = remote_repo_path )
399
408
run (["git" , "commit" , "-m" , "test file for dummyrepo" ], cwd = remote_repo_path )
400
409
@@ -403,11 +412,17 @@ def git_remote_repo_single_commit_post_init(remote_repo_path: pathlib.Path) -> N
403
412
@skip_if_git_missing
404
413
def git_remote_repo (
405
414
create_git_remote_repo : CreateRepoPytestFixtureFn ,
415
+ gitconfig : pathlib .Path ,
406
416
) -> pathlib .Path :
407
417
"""Copy the session-scoped Git repository to a temporary directory."""
408
418
# TODO: Cache the effect of of this in a session-based repo
409
419
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
+ )
411
426
return repo_path
412
427
413
428
0 commit comments