Skip to content

Commit d391886

Browse files
committed
refactor!(pytest plugin[git]) Consolidate repo creation function
1 parent faaba05 commit d391886

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

src/libvcs/pytest_plugin.py

+2-19
Original file line numberDiff line numberDiff line change
@@ -239,23 +239,6 @@ def __call__(
239239

240240

241241
def _create_git_remote_repo(
242-
remote_repos_path: pathlib.Path,
243-
remote_repo_name: str,
244-
remote_repo_post_init: Optional[CreateRepoPostInitFn] = None,
245-
init_cmd_args: InitCmdArgs = DEFAULT_GIT_REMOTE_REPO_CMD_ARGS,
246-
) -> pathlib.Path:
247-
if init_cmd_args is None:
248-
init_cmd_args = []
249-
remote_repo_path = remote_repos_path / remote_repo_name
250-
run(["git", "init", remote_repo_name, *init_cmd_args], cwd=remote_repos_path)
251-
252-
if remote_repo_post_init is not None and callable(remote_repo_post_init):
253-
remote_repo_post_init(remote_repo_path=remote_repo_path)
254-
255-
return remote_repo_path
256-
257-
258-
def _create_git_remote_repo_full_path(
259242
remote_repo_path: pathlib.Path,
260243
remote_repo_post_init: Optional[CreateRepoPostInitFn] = None,
261244
init_cmd_args: InitCmdArgs = DEFAULT_GIT_REMOTE_REPO_CMD_ARGS,
@@ -303,7 +286,7 @@ def empty_git_bare_repo(
303286
):
304287
return empty_git_bare_repo_path
305288

306-
return _create_git_remote_repo_full_path(
289+
return _create_git_remote_repo(
307290
remote_repo_path=empty_git_bare_repo_path,
308291
remote_repo_post_init=None,
309292
init_cmd_args=DEFAULT_GIT_REMOTE_REPO_CMD_ARGS, # --bare
@@ -319,7 +302,7 @@ def empty_git_repo(
319302
if empty_git_repo_path.exists() and (empty_git_repo_path / ".git").exists():
320303
return empty_git_repo_path
321304

322-
return _create_git_remote_repo_full_path(
305+
return _create_git_remote_repo(
323306
remote_repo_path=empty_git_repo_path,
324307
remote_repo_post_init=None,
325308
init_cmd_args=None,

0 commit comments

Comments
 (0)