(t *testing.T)
| 47 | } |
| 48 | |
| 49 | func TestRevertCommit(t *testing.T) { |
| 50 | t.Parallel() |
| 51 | repo := createTestRepo(t) |
| 52 | defer cleanupTestRepo(t, repo) |
| 53 | |
| 54 | seedTestRepo(t, repo) |
| 55 | commitID, _ := updateReadme(t, repo, content) |
| 56 | |
| 57 | commit, err := repo.LookupCommit(commitID) |
| 58 | checkFatal(t, err) |
| 59 | |
| 60 | revertOptions, err := DefaultRevertOptions() |
| 61 | checkFatal(t, err) |
| 62 | |
| 63 | index, err := repo.RevertCommit(commit, commit, 0, &revertOptions.MergeOptions) |
| 64 | checkFatal(t, err) |
| 65 | defer index.Free() |
| 66 | |
| 67 | err = repo.CheckoutIndex(index, &revertOptions.CheckoutOptions) |
| 68 | checkFatal(t, err) |
| 69 | |
| 70 | actualReadmeContents := readReadme(t, repo) |
| 71 | |
| 72 | if actualReadmeContents != expectedRevertedReadmeContents { |
| 73 | t.Fatalf(`README has incorrect contents after revert. Expected: "%v", Actual: "%v"`, |
| 74 | expectedRevertedReadmeContents, actualReadmeContents) |
| 75 | } |
| 76 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…