Add test which ensures all previous commits of this repo still verify

---
type: change
message: Add test which ensures all previous commits of this repo still verify
change_hash: AHoFfiByvV4MlfmaehkeGmj+vMpkkreuMu0m/vhsoTdo
credentials:
- type: pgp_signature
  pub_key_id: 95C46FA6A41148AC
  body: iQIzBAABAgAdFiEEJ6tQKp6olvZKJ0lwlcRvpqQRSKwFAl5gPEgACgkQlcRvpqQRSKx8Sw//TvPmiz/ZiClCjJhe6ipebdKYbXeMmThflSh8HWWZ14WKIe1NPpgkIlKhGJiTCxOqea8GzyvQ6SVQpAuNDsBaJbXMKbUaFR3ee1ihzIswFNx+sRF1+jNv4lPk3fnU57E1DvN4TL3kH2jNwj2UUPI872Mcx49FVumpCoP2GJikEDKeU2hbdqqSEmGzCtPabD+7I/J/AvnFb6/C9dtegKxQTYv4NeH7+jzA7Ln09BWu4sb5p0qKQtGFXVTPKWm0TLrYv6ykTNUv5E58nnexjr5uSrctORReuVz1/YY1ORV7HRz0+MlABGJXi8y6ZfzrbUd+IpkjvHuiHQv4+cMyG4KkpG1E4oHyMcSuFgqSwPLQx70LFK2G99pzW3ZL6moaCqJ5FYwAgq0qWWE1oZ+f+jravBIkfVzcCUr58JqPS7BVfesSm0BzgvKXKpCoyabyHw1+3eSLfGmE4m02ZLAjjCwmLGXPIxK+Qd6qIQt+a06p11//wV+YSKOsYKRkQHIYfnLY91FZ6XisLqVomQz+nAm9yNdvBmGzBc0kKNkglfRXfLQVe9V9+U2QYKUbBFcEPcNLzdljhIoT2agSTe6giUzmVMoybLVgOxnRDQdKa2KoW0FjAD7oecU+EIjL3WPKteYgBK2XKtbxlZlJBrqLU0ZW32dGhfbPT66SNIOZ4j8U9Tk=
  account: mediocregopher
This commit is contained in:
mediocregopher 2020-03-04 16:39:52 -07:00
parent cf05b3a072
commit 51af20fbc0

View File

@ -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)
}
}
}