6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-06 02:57:56 +00:00

Add a --branch flag that specifies which branch or tag to check out after cloning

This commit is contained in:
Grzegorz Dlugoszewski
2020-06-08 21:37:26 +02:00
parent 919359f26f
commit dfef6151d1
5 changed files with 72 additions and 12 deletions

View File

@@ -155,16 +155,36 @@ func TestStatus(t *testing.T) {
},
},
}},
{newRepoWithCheckedOutBranch, &RepoStatus{
HasUntrackedFiles: false,
HasUncommittedChanges: false,
CurrentBranch: "feature/branch1",
Branches: []*BranchStatus{
{
Name: "feature/branch1",
Upstream: "origin/feature/branch1",
Behind: 0,
Ahead: 0,
},
},
}},
{newRepoWithCheckedOutTag, &RepoStatus{
HasUntrackedFiles: false,
HasUncommittedChanges: false,
// TODO: is this correct? Can we show tag name instead of "detached HEAD"?
CurrentBranch: StatusDetached,
Branches: nil,
}},
}
for _, test := range tests {
for i, test := range tests {
repo := test.makeTestRepo(t)
err := repo.LoadStatus()
checkFatal(t, err)
if !reflect.DeepEqual(repo.Status, test.want) {
t.Errorf("Wrong repo status, got: %+v; want: %+v", repo.Status, test.want)
t.Errorf("Failed test case %d, got: %+v; want: %+v", i, repo.Status, test.want)
}
}
}