-
Notifications
You must be signed in to change notification settings - Fork 25
Implement exercise T4L5/sensors-reset #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Repo-smith currently does not support In addition, when cloning from remote repository, the default branch seems to be still |
Isn't the default branch is inherited from the cloned repo? i.e., same as the cloned repo |
|
@damithc Yes, the default branch is inherited from the cloned repo. In this case, when we clone eg. This inconsistency can lead to documentation inconsistencies, as well as some issues in verification process, eg. as shown below. We expect master_branch = exercise.repo.branches.branch_or_none("master")Though a possible solution would be branch = exercise.repo.branches.branch_or_none("master") or exercise.repo.branches.branch_or_none("main") |
hmm... we probably have to migrate the entire git-mastery to use one ( |
|
@damithc I remember it being discussed somewhere (though I cannot trace the exact issue), that it was decided that But, given the constraints, I think it could be possible to switch everything to Regarding effort needed, we would need to:
Alternatively, we can keep what we have currently at the cost of some (technical) debt. This means for example, in this exercise, we cannot assume @VikramGoyal23 @woojiahao What are your thoughts on this? |
Yes, I discussed this issue in git-mastery/git-mastery#49. During an in-person discussion, Damith mentioned the value of using both interchangeably to get students familiarized with different default branches. Certainly, we can try to fully commit to one branch or the other, but either would require much effort- |
|
@jovnc Can you uncomment all the unit tests and run them? I can give a proper review once that's done. |
|
@VikramGoyal23 Had to make some major changes to the tests and verify logic, as I realised some limitations in the existing verify logic (as I can only verify the end state, and not the in between state for each task). |
VikramGoyal23
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just need to update the branch logic and it can be merged.
| comments: str = [] | ||
| if len(unstaged_files) != 4 or not all( | ||
| file in unstaged_files | ||
| for file in ["east.csv", "north.csv", "south.csv", "west.csv"] | ||
| ): | ||
| comments.append(WRONG_FILES_IN_WORKING_DIRECTORY) | ||
|
|
||
| if len(staged_files) != 3 or not all( | ||
| file in staged_files for file in ["east.csv", "north.csv", "south.csv"] | ||
| ): | ||
| comments.append(WRONG_FILES_IN_STAGING_AREA) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I initially thought that this logic could be easily circumvented by choosing a set of incorrect commits to reset to, such a set of commits (other than the one mentioned in the exercise instructions) does not exist, making this logic sound in all cases.
VikramGoyal23
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgive me, I forgot to write down one more small nit I had.
| if "Record data for Jan 12" in commit_messages: | ||
| raise exercise.wrong_answer([CONTAINS_TASK_THREE_COMMIT]) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we explicitly check that the head is at January 11th after this for extra safety?
|
@VikramGoyal23 I have made the changes, thanks! |
|
|
||
|
|
||
| def verify(exercise: GitAutograderExercise) -> GitAutograderOutput: | ||
| branch = exercise.repo.branches.branch_or_none("main") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically we don't need branch_or_none but it's fine to keep here.
VikramGoyal23
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Exercise Review
Exercise Discussion
Fixes #145
Checklist
Git-Masteryorganization, have you created a request for it?repo-smithto validate the exercise grading scheme?test-download.sh?git-autograder?app?