Make bisect playable and validate commit_in_future using Git author timestamps

This commit is contained in:
Joe Tretter
2026-05-18 19:44:23 -05:00
parent f5bd5f5a60
commit afb548d46f
10 changed files with 256 additions and 36 deletions

View File

@@ -130,6 +130,15 @@ class LevelSolutionsTest {
"Starting an interactive rebase without an upstream/range must not solve the reorder level.",
reorderExercise.validator(bareInteractiveRebaseRepo, "git rebase -i"),
)
val futureCommitExercise = commitInFutureLevel()
val futureCommitRuntime = GitRepositoryRuntime(runtimeRoot, gitBinary)
val futureCommitRepo = futureCommitRuntime.prepareLevel(futureCommitExercise)
val (currentDateCommitRepo, _) = futureCommitRuntime.execute(futureCommitExercise, futureCommitRepo, "git commit -m \"Current date commit\"")
assertFalse(
"A normal commit using the current system date must not solve the commit_in_future level.",
futureCommitExercise.validator(currentDateCommitRepo, "git commit -m \"Current date commit\""),
)
}
private companion object {
@@ -213,7 +222,7 @@ class LevelSolutionsTest {
appendLine(" <none>")
} else {
commits.forEach { commit ->
appendLine(" ${commit.id} ${commit.message}")
appendLine(" ${commit.id} ${commit.authorTimestampSeconds ?: "unknown-time"} ${commit.message}")
}
}
}