Skip to content

Conversation

@jovnc
Copy link
Collaborator

@jovnc jovnc commented Dec 12, 2025

Exercise Review

Exercise Discussion

Fixes #144

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?

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

jovnc commented Dec 12, 2025

I'm not sure if its necessary to check reflog that the student performed checkout to the correct commit, as it is almost certain that the student has performed the checkout, else they won't have been able to get the answer.

I have written an alternative implementation with reflog checks, but it seems a little hard to write the repo-smith tests for now (repo-smith supports checkout to specific commit-hash, but there is not way for us to get the commit hash)

def verify(exercise: GitAutograderExercise) -> GitAutograderOutput:
    if not verify_single_checkout(exercise, "Jan 11"):
        raise exercise.wrong_answer(
            [REFLOG_MISSING_TRAVERSAL.format(missing_date="Jan 11")]
        )
    exercise.answers.add_validation(
        QUESTION_ONE,
        NotEmptyRule(),
        HasExactValueRule(CORRECT_ANSWER_Q1, is_case_sensitive=True),
    ).validate()

    if not verify_single_checkout(exercise, "Jan 09"):
        raise exercise.wrong_answer(
            [REFLOG_MISSING_TRAVERSAL.format(missing_date="Jan 09")]
        )    
    exercise.answers.add_validation(
        QUESTION_TWO,
        NotEmptyRule(),
        HasExactValueRule(CORRECT_ANSWER_Q2, is_case_sensitive=True),
    ).validate()

    if not verify_single_checkout(exercise, "Jan 05"):
        raise exercise.wrong_answer(
            [REFLOG_MISSING_TRAVERSAL.format(missing_date="Jan 05")]
        )
    exercise.answers.add_validation(
        QUESTION_THREE,
        NotEmptyRule(),
        HasExactValueRule(CORRECT_ANSWER_Q3, is_case_sensitive=True),
    ).validate()

    return exercise.to_output([SUCCESS_MESSAGE], GitAutograderStatus.SUCCESSFUL)

@jovnc
Copy link
Collaborator Author

jovnc commented Dec 12, 2025

For now, this seems to be sufficient, and performing reflog checks can be a possible future enhancement.

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] T4L4 Traversing to a Specific Commit

1 participant