Skip to content

[glossary-branch-rename] Improve verify logic and update tests#263

Merged
SAN-MUYUN merged 4 commits intogit-mastery:mainfrom
desmondwong1215:fix/glossary-branch-rename
Feb 11, 2026
Merged

[glossary-branch-rename] Improve verify logic and update tests#263
SAN-MUYUN merged 4 commits intogit-mastery:mainfrom
desmondwong1215:fix/glossary-branch-rename

Conversation

@desmondwong1215
Copy link
Contributor

Fixes #262

@github-actions
Copy link

github-actions bot commented Feb 8, 2026

Hi @desmondwong1215, thank you for your contribution! 🎉

This PR comes from your fork desmondwong1215/exercises on branch fix/glossary-branch-rename.

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": "fix/glossary-branch-rename"
    }
}

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.

Copy link
Contributor

@SAN-MUYUN SAN-MUYUN left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this bug! Apart from small adjustment to the comment and RESET_MESSAGE, other changes LGTM!


This is necessary since the renames could be performed in parts:

login -> feat/login -> feature/login
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this method is exercise specific, let's make the comment more relevant to our exercise

STU_REMOTE_PRESENT = f"Remote branch {STU_BRANCH} still exists."
RENAMED_REMOTE_MISSING = f"Remote branch {RENAMED_BRANCH} is missing."
NO_RENAME_EVIDENCE = f"Local branch '{STU_BRANCH}' was not renamed to '{RENAMED_BRANCH}'!"
RESET_MESSAGE = 'Reset the repository using "gitmastery progress reset" and start again'
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the RESET_MESSAGE as it is possible that the users do somethings wrong and unable to continue.

I think it would be better if we change the message to If needed, ... and start again.
When users failed to rename the branches, it is not necessary that they always end up in a state where there is no return and have to go for reset. Don't forget the fullstop at the end :)

if original == old_branch:
old_branch = new

return old_branch == new_branch
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM!

@jovnc
Copy link
Collaborator

jovnc commented Feb 9, 2026

@desmondwong1215 @SAN-MUYUN Feel free to merge when ready

@SAN-MUYUN SAN-MUYUN merged commit d5a09c7 into git-mastery:main Feb 11, 2026
4 checks passed
@desmondwong1215 desmondwong1215 deleted the fix/glossary-branch-rename branch February 12, 2026 05:06
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.

[glossary-branch-rename] Fix verify logic bug

3 participants