Skip to content

Conversation

@VikramGoyal23
Copy link
Collaborator

@VikramGoyal23 VikramGoyal23 commented Dec 10, 2025

Exercise Review

Exercise Discussion

#68

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 the download script using test-download.sh?
  • 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?

There seems to be some issue with the squash
option for the merge step in repo-smith
@VikramGoyal23
Copy link
Collaborator Author

VikramGoyal23 commented Dec 10, 2025

This pull request is not yet complete, the testing needs to be cleaned up.

@VikramGoyal23 VikramGoyal23 requested a review from jovnc December 11, 2025 07:36
@jovnc jovnc linked an issue Dec 11, 2025 that may be closed by this pull request
1 task
Copy link
Collaborator

@jovnc jovnc left a comment

Choose a reason for hiding this comment

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

LGTM, tests looks comprehensive enough, some minor changes needed on verification process before merging.


commit_messages_in_main = [c.commit.message.strip() for c in main_branch.commits]

merge_commits = [c for c in main_branch.commits if len(c.parents) > 1]
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 the logic here is that we want to ensure a linear history by ensuring that there are no commits with multiple parents (that can indicate a merge commit).

But I think that it is also possible to pass this verification using git -i rebase.

However, I'm not sure if there's a better way to verify squash merge, so this LGTM for now

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point, I was wary of using commit messages for verification purposes but I think it's best to check if the latest commit message has the word "Squash" to ensure a proper squash merge.

@VikramGoyal23
Copy link
Collaborator Author

I moved around some of the verification logic as well, since to me, it made more sense to check if the proper type of merge was used after checking if the changes were even present.

@jovnc jovnc added exercise review Review a proposed exercise discussing labels Dec 12, 2025
Copy link
Collaborator

@jovnc jovnc left a comment

Choose a reason for hiding this comment

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

I think that we could be safer with more tests, and the verification logic can be improved

@VikramGoyal23 VikramGoyal23 requested a review from jovnc December 17, 2025 13:06
Copy link
Collaborator

@jovnc jovnc left a comment

Choose a reason for hiding this comment

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

Just a last nit on verify.py, but other than that everything else LGTM

def verify(exercise: GitAutograderExercise) -> GitAutograderOutput:
main_branch = exercise.repo.branches.branch("main")

with exercise.repo.files.file_or_none("mike.txt") as mike_file:
Copy link
Collaborator

Choose a reason for hiding this comment

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

We might need to handle the case where we perform a squash merge, but the files are not committed, as the current test checks for existence of file, but doesn't check that we have committed the squash merge.
eg. git merge --squash supporting but we don't commit the changes would still pass the tests

Perhaps we could check that there are no uncommitted files, but we cannot replicate this is repo-smith currently.

if exercise.repo.repo.is_dirty():
        raise exercise.wrong_answer([SQUASH_NOT_COMMITTED])

@VikramGoyal23
Copy link
Collaborator Author

I've added a check for any uncommitted files. Unfortunately, the repo-smith implementation of a squash merge also automatically performs a commit, so we can't add a test for it, as you said.

Copy link
Collaborator

@jovnc jovnc left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for addressing the comments!

@jovnc jovnc merged commit bd570ee into git-mastery:main Dec 18, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

discussing exercise review Review a proposed exercise

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Exercise Discussion] T6L2/merge-squash

2 participants