Skip to content

Commit 38486e7

Browse files
committed
Address PR comments
1 parent ebfe71f commit 38486e7

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

exercise_utils/github_cli.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
def fork_repo(
1010
repository_name: str, fork_name: str, verbose: bool, default_branch_only: bool = True
1111
) -> None:
12-
"""Creates a fork of a repository."""
12+
"""
13+
Creates a fork of a repository.
14+
Forks only the default branch, unless specified otherwise.
15+
"""
1316
command = ["gh", "repo", "fork", repository_name]
1417
if default_branch_only:
1518
command.append("--default-branch-only")

hands_on/remote_branch_push.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616
def download(verbose: bool):
1717
username = get_github_username(verbose)
1818

19-
if has_fork(REPO_NAME, REPO_OWNER, username, verbose):
20-
existing_name = get_fork_name(REPO_NAME, REPO_OWNER, username, verbose)
21-
clone_repo_with_git(f"https://github.com/{username}/{existing_name}", verbose, FORK_NAME)
22-
return
19+
if not has_fork(REPO_NAME, REPO_OWNER, username, verbose):
20+
fork_repo(
21+
f"{REPO_OWNER}/{REPO_NAME}", FORK_NAME, verbose, False
22+
)
2323

24-
fork_repo(
25-
f"{REPO_OWNER}/{REPO_NAME}", FORK_NAME, verbose, False
26-
)
27-
clone_repo_with_git(f"https://github.com/{username}/{FORK_NAME}", verbose, FORK_NAME)
24+
existing_name = get_fork_name(REPO_NAME, REPO_OWNER, username, verbose)
25+
clone_repo_with_git(f"https://github.com/{username}/{existing_name}", verbose, FORK_NAME)

0 commit comments

Comments
 (0)