6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-05 14:48:47 +00:00

Add CloneRepo function and unit tests for cloned repos status

This commit is contained in:
Grzegorz Dlugoszewski
2020-05-19 14:12:38 +02:00
parent a0f09ef74d
commit dfc8437408
5 changed files with 130 additions and 32 deletions

View File

@@ -140,6 +140,28 @@ func TestStatusWithMultipleCommits(t *testing.T) {
if len(entries) != 0 {
t.Errorf("Repo with no uncommitted files should have no status entries")
}
status, err := NewRepoStatus(repo.Workdir())
checkFatal(t, err)
want := RepoStatus{
HasUntrackedFiles: false,
HasUncommittedChanges: false,
BranchStatuses: nil,
}
if !reflect.DeepEqual(status, want) {
t.Errorf("Wrong repo status, got %+v; want %+v", status, want)
}
}
func TestStatusCloned(t *testing.T) {
origin := newTestRepo(t)
dir := newTempDir(t)
repo, err := CloneRepo(origin.Path(), dir)
checkFatal(t, err)
status, err := NewRepoStatus(repo.Workdir())
checkFatal(t, err)