Skip to content

Commit a0d7070

Browse files
committed
FIX: forking should do nothing if already exists
1 parent bf16491 commit a0d7070

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

conda_forge_tick/git_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,8 @@ def push_to_repository(
961961
@lock_git_operation()
962962
def fork(self, owner: str, repo_name: str):
963963
if repo_name in self._repos:
964-
raise ValueError(f"Fork of {repo_name} already exists.")
964+
logger.debug(f"Fork of {repo_name} already exists. Doing nothing.")
965+
return
965966

966967
logger.debug(
967968
f"Dry Run: Creating fork of {owner}/{repo_name} for user {self._USER}."

tests/test_git_utils.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,11 +1635,8 @@ def test_dry_run_backend_fork(caplog):
16351635
in caplog.text
16361636
)
16371637

1638-
with pytest.raises(ValueError, match="Fork of REPO already exists"):
1639-
backend.fork("UPSTREAM_OWNER", "REPO")
1640-
1641-
with pytest.raises(ValueError, match="Fork of REPO already exists"):
1642-
backend.fork("OTHER_OWNER", "REPO")
1638+
# this should not raise an error
1639+
backend.fork("UPSTREAM_OWNER", "REPO")
16431640

16441641

16451642
def test_dry_run_backend_sync_default_branch(caplog):

0 commit comments

Comments
 (0)