diff --git a/repo_test.go b/repo_test.go index 7501b81..605d13e 100644 --- a/repo_test.go +++ b/repo_test.go @@ -222,3 +222,28 @@ accounts: t.Fatalf("config fix commit %q should be verifiable, but got: %v", hash2, err) } } + +// TestThisRepoStillVerifies opens this actual repository and ensures that all +// commits in it still verify, given this codebase. +func TestThisRepoStillVerifies(t *testing.T) { + repo, err := OpenRepo(".") + if err != nil { + t.Fatalf("error opening repo: %v", err) + } + + headCommit, _, err := repo.head() + if err != nil { + t.Fatalf("error getting repo head: %v", err) + } + + checkedOutBranch, err := repo.CheckedOutBranch() + if err != nil { + t.Fatalf("error determining checked out branch: %v", err) + } + + for _, hash := range headCommit.ParentHashes { + if err := repo.VerifyCommit(checkedOutBranch, hash); err != nil { + t.Fatalf("error verifying commit %q of branch %q: %v", hash, checkedOutBranch, err) + } + } +}