@@ -285,6 +285,22 @@ def empty_git_repo_path(libvcs_test_cache_path: pathlib.Path) -> pathlib.Path:
285285 return libvcs_test_cache_path / "empty_git_repo"
286286
287287
288+ @pytest .fixture (scope = "session" )
289+ @skip_if_git_missing
290+ def empty_git_bare_repo (
291+ empty_git_repo_path : pathlib .Path ,
292+ ) -> pathlib .Path :
293+ """Return factory to create git remote repo to for clone / push purposes."""
294+ if empty_git_repo_path .exists () and (empty_git_repo_path / ".git" ).exists ():
295+ return empty_git_repo_path
296+
297+ return _create_git_remote_repo_full_path (
298+ remote_repo_path = empty_git_repo_path ,
299+ remote_repo_post_init = None ,
300+ init_cmd_args = DEFAULT_GIT_REMOTE_REPO_CMD_ARGS , # --bare
301+ )
302+
303+
288304@pytest .fixture (scope = "session" )
289305@skip_if_git_missing
290306def empty_git_repo (
@@ -297,9 +313,48 @@ def empty_git_repo(
297313 return _create_git_remote_repo_full_path (
298314 remote_repo_path = empty_git_repo_path ,
299315 remote_repo_post_init = None ,
316+ init_cmd_args = None ,
300317 )
301318
302319
320+ @pytest .fixture
321+ @skip_if_git_missing
322+ def create_git_remote_bare_repo (
323+ remote_repos_path : pathlib .Path ,
324+ empty_git_bare_repo : pathlib .Path ,
325+ ) -> CreateRepoPytestFixtureFn :
326+ """Return factory to create git remote repo to for clone / push purposes."""
327+
328+ def fn (
329+ remote_repos_path : pathlib .Path = remote_repos_path ,
330+ remote_repo_name : Optional [str ] = None ,
331+ remote_repo_post_init : Optional [CreateRepoPostInitFn ] = None ,
332+ init_cmd_args : InitCmdArgs = DEFAULT_GIT_REMOTE_REPO_CMD_ARGS ,
333+ ) -> pathlib .Path :
334+ if remote_repo_name is None :
335+ remote_repo_name = unique_repo_name (remote_repos_path = remote_repos_path )
336+ remote_repo_path = remote_repos_path / remote_repo_name
337+
338+ shutil .copytree (empty_git_bare_repo , remote_repo_path )
339+
340+ assert empty_git_bare_repo .exists ()
341+
342+ assert remote_repo_path .exists ()
343+
344+ return remote_repo_path
345+
346+ # return _create_git_remote_repo(
347+ # remote_repos_path=remote_repos_path,
348+ # remote_repo_name=remote_repo_name
349+ # if remote_repo_name is not None
350+ # else unique_repo_name(remote_repos_path=remote_repos_path),
351+ # remote_repo_post_init=remote_repo_post_init,
352+ # init_cmd_args=init_cmd_args,
353+ # )
354+
355+ return fn
356+
357+
303358@pytest .fixture
304359@skip_if_git_missing
305360def create_git_remote_repo (
@@ -323,6 +378,12 @@ def fn(
323378 if remote_repo_post_init is not None and callable (remote_repo_post_init ):
324379 remote_repo_post_init (remote_repo_path = remote_repo_path )
325380
381+ assert empty_git_repo .exists ()
382+ assert (empty_git_repo / ".git" ).exists ()
383+
384+ assert remote_repo_path .exists ()
385+ assert (remote_repo_path / ".git" ).exists ()
386+
326387 return remote_repo_path
327388
328389 # return _create_git_remote_repo(
@@ -357,15 +418,28 @@ def session_git_remote_repo(remote_repos_path: pathlib.Path) -> pathlib.Path:
357418 )
358419
359420
421+ @pytest .fixture (scope = "session" )
422+ @skip_if_git_missing
423+ def session_git_remote_bare_repo (remote_repos_path : pathlib .Path ) -> pathlib .Path :
424+ """Pre-made git repo w/ 1 commit, used as a file:// remote to clone and push to."""
425+ return _create_git_remote_repo_full_path (
426+ remote_repo_path = remote_repos_path / "dummyrepo" ,
427+ remote_repo_post_init = git_remote_repo_single_commit_post_init ,
428+ )
429+
430+
360431@pytest .fixture
361432@skip_if_git_missing
362433def git_remote_repo (
363- session_git_remote_repo : pathlib .Path , tmp_path : pathlib .Path
434+ # session_git_remote_bare_repo: pathlib.Path,
435+ # tmp_path: pathlib.Path,
436+ create_git_remote_repo : CreateRepoPytestFixtureFn ,
364437) -> pathlib .Path :
365438 """Copy the session-scoped Git repository to a temporary directory."""
366- temp_repo_path = tmp_path / session_git_remote_repo .name
367- shutil .copytree (session_git_remote_repo , temp_repo_path )
368- return temp_repo_path
439+ return create_git_remote_repo ()
440+ # temp_repo_path = tmp_path / session_git_remote_repo.name
441+ # shutil.copytree(session_git_remote_bare_repo, temp_repo_path)
442+ # return temp_repo_path
369443
370444
371445def _create_svn_remote_repo (
0 commit comments