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:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user