forgetContents rewrites contents into a new blob and deletes the blob making index entries dangling.
(t *testing.T, env *testenv.CLITest, contentIDs ...string)
| 365 | // forgetContents rewrites contents into a new blob and deletes the blob |
| 366 | // making index entries dangling. |
| 367 | func forgetContents(t *testing.T, env *testenv.CLITest, contentIDs ...string) { |
| 368 | t.Helper() |
| 369 | |
| 370 | before := mustGetContentMap(t, env) |
| 371 | |
| 372 | env.RunAndExpectSuccess(t, append([]string{"content", "rewrite", "--safety=none"}, contentIDs...)...) |
| 373 | |
| 374 | after := mustGetContentMap(t, env) |
| 375 | |
| 376 | var blobIDs []string |
| 377 | |
| 378 | for _, cidStr := range contentIDs { |
| 379 | cid, err := content.ParseID(cidStr) |
| 380 | require.NoError(t, err) |
| 381 | require.NotEqual(t, before[cid].PackBlobID, after[cid].PackBlobID) |
| 382 | blobIDs = append(blobIDs, string(after[cid].PackBlobID)) |
| 383 | } |
| 384 | |
| 385 | env.RunAndExpectSuccess(t, append([]string{"blob", "rm"}, blobIDs...)...) |
| 386 | } |
| 387 | |
| 388 | func mustGetContentMap(t *testing.T, env *testenv.CLITest) map[content.ID]content.Info { |
| 389 | t.Helper() |
no test coverage detected