Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/commands/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def setup_exercise_folder(
info("You already have a fork, deleting it")
delete_repo(fork_name)
info("Creating fork of exercise repository")
fork(exercise_repo, fork_name)
fork(exercise_repo, fork_name, config.exercise_repo.fork_all_branches)
info("Creating clone of your fork")
clone_with_custom_name(
f"{username}/{fork_name}", config.exercise_repo.repo_name
Expand Down
2 changes: 2 additions & 0 deletions app/configs/exercise_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class ExerciseRepoConfig:
repo_name: str
repo_title: Optional[str]
create_fork: Optional[bool]
fork_all_branches: Optional[bool]
init: Optional[bool]

exercise_name: str
Expand Down Expand Up @@ -72,6 +73,7 @@ def read(cls: Type[Self], path: Path, cds: int) -> Self:
repo_name=exercise_repo["repo_name"],
repo_title=exercise_repo["repo_title"],
create_fork=exercise_repo["create_fork"],
fork_all_branches=exercise_repo["fork_all_branches"],
init=exercise_repo["init"],
),
downloaded_at=None,
Expand Down
24 changes: 12 additions & 12 deletions app/utils/github_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,18 @@ def get_repo_https_url(repo: str) -> Optional[str]:
return None


def fork(repository_name: str, fork_name: str) -> None:
run(
[
"gh",
"repo",
"fork",
repository_name,
"--default-branch-only",
"--fork-name",
fork_name,
],
)
def fork(repository_name: str, fork_name: str, all_branches: bool | None = False) -> None:
fork_command = [
"gh",
"repo",
"fork",
repository_name,
"--fork-name",
fork_name,
]
if all_branches == None or not all_branches:
fork_command.append("--default-branch-only")
run(fork_command)


def clone(repository_name: str) -> None:
Expand Down