checkSecondFileStaged checks that there is a single file called "file2" uncommitted in the repo
(t *testing.T, repo *Repository)
| 596 | |
| 597 | // checkSecondFileStaged checks that there is a single file called "file2" uncommitted in the repo |
| 598 | func checkSecondFileStaged(t *testing.T, repo *Repository) { |
| 599 | opts := StatusOptions{ |
| 600 | Show: StatusShowIndexAndWorkdir, |
| 601 | Flags: StatusOptIncludeUntracked, |
| 602 | } |
| 603 | |
| 604 | statuses, err := repo.StatusList(&opts) |
| 605 | checkFatal(t, err) |
| 606 | |
| 607 | count, err := statuses.EntryCount() |
| 608 | checkFatal(t, err) |
| 609 | |
| 610 | if count != 1 { |
| 611 | t.Error("diff should affect exactly one file") |
| 612 | } |
| 613 | if count == 0 { |
| 614 | t.Fatal("no statuses, cannot continue test") |
| 615 | } |
| 616 | |
| 617 | entry, err := statuses.ByIndex(0) |
| 618 | checkFatal(t, err) |
| 619 | |
| 620 | if entry.Status != StatusIndexNew { |
| 621 | t.Error("status should be 'new' as file has been added between commits") |
| 622 | } |
| 623 | |
| 624 | if entry.HeadToIndex.NewFile.Path != "file2" { |
| 625 | t.Error("new file should be 'file2") |
| 626 | } |
| 627 | return |
| 628 | } |
| 629 | |
| 630 | // checkNoFilesStaged checks that there is a single file called "file2" uncommitted in the repo |
| 631 | func checkNoFilesStaged(t *testing.T, repo *Repository) { |
no test coverage detected
searching dependent graphs…