Skip to content

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.
"""
)

Comment on lines +48 to +57
else:
def_branch = repo.branches.branch("DEF").branch
remote_def = def_branch.tracking_branch()
if remote_def:
local_commits = set(commit.hexsha for commit in repo.branches.branch("DEF").commits)
remote_commit_hexsha = remote_def.commit.hexsha
if remote_commit_hexsha not in local_commits:
comments.append(COMMIT_MISSING.format(branch="DEF"))
else:
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.

I think it would be better if we also checked that the student did not, perchance, delete the local commit (since they might take a wrong approach to resolve the merge conflict). You can check the existence of the commit using this function by jovnc:

def get_commit_from_message(
    commits: List[GitAutograderCommit], message: str
) -> Optional[GitAutograderCommit]:
    """Find a commit with the given message from a list of commits."""
    for commit in commits:
        if message.strip() == commit.commit.message.strip():
            return commit
    return None

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

2 participants