(t *testing.T)
| 391 | } |
| 392 | |
| 393 | func TestClientCommitsReturnsCommitMetadata(t *testing.T) { |
| 394 | // Given a branch with commits containing empty and multiline bodies |
| 395 | repo := newTestRepo(t) |
| 396 | repo.run(t, "commit", "--quiet", "--allow-empty", "-m", "base") |
| 397 | baseRef := repo.run(t, "rev-parse", "HEAD") |
| 398 | repo.run(t, "checkout", "--quiet", "-b", "feature") |
| 399 | repo.run(t, "commit", "--quiet", "--allow-empty", "-m", "first commit") |
| 400 | firstSHA := repo.run(t, "rev-parse", "HEAD") |
| 401 | repo.run(t, "commit", "--quiet", "--allow-empty", "-m", "second commit", "-m", "first line\nsecond line") |
| 402 | secondSHA := repo.run(t, "rev-parse", "HEAD") |
| 403 | |
| 404 | // When commits unique to the feature branch are requested |
| 405 | commits, err := repo.client.Commits(t.Context(), baseRef, "feature") |
| 406 | |
| 407 | // Then each commit's repository metadata is returned newest first |
| 408 | require.NoError(t, err) |
| 409 | assert.Equal(t, []*Commit{ |
| 410 | {Sha: secondSHA, Title: "second commit", Body: "first line\nsecond line\n"}, |
| 411 | {Sha: firstSHA, Title: "first commit"}, |
| 412 | }, commits) |
| 413 | } |
| 414 | |
| 415 | func TestClientCommitsReportsNoCommitsBetweenRefs(t *testing.T) { |
| 416 | // Given two refs that identify the same commit |
nothing calls this directly
no test coverage detected