Skip to content

Implement T8L2/glossary-branch-pull#242

Merged
VikramGoyal23 merged 18 commits intogit-mastery:mainfrom
desmondwong1215:e-glossary-branch-pull
Feb 6, 2026
Merged

Implement T8L2/glossary-branch-pull#242
VikramGoyal23 merged 18 commits intogit-mastery:mainfrom
desmondwong1215:e-glossary-branch-pull

Conversation

@desmondwong1215
Copy link
Contributor

Exercise Review

Exercise Discussion

Fixes #237

Checklist

  • If you require a new remote repository on the Git-Mastery organization, have you created a request for it?
  • Have you written unit tests using repo-smith to validate the exercise grading scheme?
  • Have you tested your changes using the instructions posted?
  • 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?
  • Did you introduce a new dependency that should belong to app?

@github-actions
Copy link

Hi @desmondwong1215, thank you for your contribution! 🎉

This PR comes from your fork desmondwong1215/exercises on branch e-glossary-branch-pull.

Before you request for a review, please ensure that you have tested your changes locally!

Important

The previously recommended way of using ./test-download.py is no longer the best way to test your changes locally.

Please read the following instructions for the latest instructions.

Prerequisites

Ensure that you have the gitmastery app installed locally (instructions)

Testing steps

If you already have a local Git-Mastery root to test, you can skip the following step.

Create a Git-Mastery root locally:

gitmastery setup

Navigate into the Git-Mastery root (defaults to gitmastery-exercises/):

cd gitmastery-exercises/

Edit the .gitmastery.json configuration file. You need to set the following values under the exercises_source key.

{
    # other fields...
    "exercises_source": {
        "username": "desmondwong1215",
        "repository": "exercises",
        "branch": "e-glossary-branch-pull"
    }
}

Then, you can use the gitmastery app to download and verify your changes locally.

gitmastery download <your new change>
gitmastery verify

Checklist

  • (For exercises and hands-ons) I have verified that the downloading behavior works
  • (For exercises only) I have verified that the verification behavior is accurate

Important

To any reviewers of this pull request, please use the same instructions above to test the changes.

@VikramGoyal23
Copy link
Collaborator

@desmondwong1215 Can you indicate by mentioning us when this PR is ready for our review, as it seems you're still working on it? Another method you could use is to mark this PR as a draft until it's ready to be reviewed.

@desmondwong1215 desmondwong1215 marked this pull request as draft January 20, 2026 02:36
@desmondwong1215 desmondwong1215 marked this pull request as ready for review January 20, 2026 03:21
@desmondwong1215
Copy link
Contributor Author

Hi @VikramGoyal23, this PR is ready for review. Thanks

@VikramGoyal23 VikramGoyal23 self-requested a review January 21, 2026 01:48
Copy link
Collaborator

@VikramGoyal23 VikramGoyal23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM. Just a nit and some minor changes to logic for now, while we wait on the update to repo-smith to support unit tests.


checkout("DEF", False, verbose)
run_command(["git", "reset", "--hard", "HEAD~1"], verbose)
create_or_update_file("e.txt", "documentation: Evidence that someone once cared.\n")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is more idiomatic to use a multiline string here.

Suggested change
create_or_update_file("e.txt", "documentation: Evidence that someone once cared.\n")
create_or_update_file(
"e.txt",
"""
documentation: Evidence that someone once cared.
"""
)

@desmondwong1215 desmondwong1215 marked this pull request as draft January 26, 2026 15:09
@jovnc jovnc changed the title [Exercise: glossary-branch-pull] T8L2. Pulling Branches from a Remote Implement T8L2/glossary-branch-pull Jan 27, 2026
@desmondwong1215 desmondwong1215 marked this pull request as ready for review February 1, 2026 09:29
@jovnc
Copy link
Collaborator

jovnc commented Feb 4, 2026

@VikramGoyal23 Let's get this merged soon

@VikramGoyal23 VikramGoyal23 self-requested a review February 5, 2026 01:15
@jovnc
Copy link
Collaborator

jovnc commented Feb 6, 2026

@VikramGoyal23 Let's get this merged soon so tour 8 can be released to students

Copy link
Collaborator

@VikramGoyal23 VikramGoyal23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some changes in verification logic are required, and I have a few nits, but otherwise it mostly LGTM.


checkout("DEF", False, verbose)
run_command(["git", "reset", "--hard", "HEAD~1"], verbose)
create_or_update_file("d.txt", "documentation: Evidence that someone once cared.\n")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is more idiomatic to use a multiline string here.

Suggested change
create_or_update_file("d.txt", "documentation: Evidence that someone once cared.\n")
create_or_update_file(
"d.txt",
"""
documentation: Evidence that someone once cared.
"""
)

Comment on lines 39 to 43
try:
exercise.repo.repo.refs["origin/STU"]
except (IndexError, KeyError):
comments.append(BRANCH_NOT_TRACKING.format(branch="STU"))
pass
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to work for checking if the branch is actually tracking, creating a new branch using the -b option also works. The reason for this is that it checks if the local branch and reference to the upstream (origin) branch exist, but not if the local tracks the upstream. Consider changing it back to the old version:

Suggested change
try:
exercise.repo.repo.refs["origin/STU"]
except (IndexError, KeyError):
comments.append(BRANCH_NOT_TRACKING.format(branch="STU"))
pass
stu_branch = repo.branches.branch("STU").branch
tracking = stu_branch.tracking_branch()
if not tracking or tracking.name != 'origin/STU':
comments.append(BRANCH_NOT_TRACKING.format(branch="STU"))

Comment on lines 48 to 52
try:
exercise.repo.repo.refs["origin/VWX"]
except (IndexError, KeyError):
comments.append(BRANCH_NOT_TRACKING.format(branch="VWX"))
pass
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment on STU branch checking.

Comment on lines 62 to 64
except (IndexError, KeyError):
comments.append(BRANCH_NOT_TRACKING.format(branch="ABC"))
pass
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment on STU branch checking.

Comment on lines 76 to 77
except (IndexError, KeyError):
comments.append(BRANCH_NOT_TRACKING.format(branch="DEF"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment on STU branch checking.

Copy link
Collaborator

@VikramGoyal23 VikramGoyal23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@VikramGoyal23 VikramGoyal23 merged commit e61be0b into git-mastery:main Feb 6, 2026
4 checks passed
@desmondwong1215 desmondwong1215 deleted the e-glossary-branch-pull branch February 9, 2026 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Exercise: glossary-branch-pull] T8L2. Pulling Branches from a Remote

3 participants