Skip to content

Commit b319ba1

Browse files
authored
[hp-remote-branch-push] Improve hands-on T8L1/hp-remote-branch-push (#231)
# Exercise Review ## Exercise Discussion Fixes #186 ## Checklist - [ ] If you require a new remote repository on the `Git-Mastery` organization, have you [created a request](https://github.com/git-mastery/exercises/issues/new?template=request_exercise_repository.yaml) for it? - [ ] Have you written unit tests using [`repo-smith`](https://github.com/git-mastery/repo-smith) to validate the exercise grading scheme? - [x] Have you tested your changes using the instructions posted? - [x] Have you verified that this exercise does not already exist or is not currently in review? - [ ] Did you introduce a new grading mechanism that should belong to [`git-autograder`](https://github.com/git-mastery/git-autograder)? - [ ] Did you introduce a new dependency that should belong to [`app`](https://github.com/git-mastery/app)?
1 parent 4c4d54c commit b319ba1

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

hands_on/remote_branch_push.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
from exercise_utils.git import clone_repo_with_git
22
from exercise_utils.github_cli import (
3+
delete_repo,
34
fork_repo,
45
get_fork_name,
56
get_github_username,
6-
has_fork,
7+
has_repo,
78
)
89

910
__requires_git__ = True
@@ -16,11 +17,15 @@
1617

1718
def download(verbose: bool):
1819
username = get_github_username(verbose)
20+
full_repo_name = f"{username}/{FORK_NAME}"
1921

20-
if not has_fork(REPO_NAME, REPO_OWNER, username, verbose):
21-
fork_repo(f"{REPO_OWNER}/{REPO_NAME}", FORK_NAME, verbose, False)
22+
if has_repo(full_repo_name, True, verbose):
23+
delete_repo(full_repo_name, verbose)
24+
25+
fork_repo(f"{REPO_OWNER}/{REPO_NAME}", FORK_NAME, verbose, False)
2226

2327
existing_name = get_fork_name(REPO_NAME, REPO_OWNER, username, verbose)
2428
clone_repo_with_git(
25-
f"https://github.com/{username}/{existing_name}", verbose, FORK_NAME
29+
f"https://github.com/{username}/{existing_name}", verbose, REPO_NAME
2630
)
31+

0 commit comments

Comments
 (0)