6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-07 19:54:19 +00:00

Add branch checkout helper and test branches being ahead of upstream

This commit is contained in:
Grzegorz Dlugoszewski
2020-05-19 17:32:04 +02:00
parent 4bf531be9c
commit 307b2cd4a2
2 changed files with 51 additions and 1 deletions

View File

@@ -37,10 +37,17 @@ func TestClonedBranches(t *testing.T) {
stageFile(t, origin, "file")
createCommit(t, origin, "Initial commit")
createBranch(t, origin, "branch")
repo, err := CloneRepo(origin.Path(), newTempDir(t))
checkFatal(t, err)
createBranch(t, repo, "branch")
createBranch(t, repo, "local")
checkoutBranch(t, repo, "branch")
createFile(t, repo, "anotherFile")
stageFile(t, repo, "anotherFile")
createCommit(t, repo, "Second commit")
branches, err := Branches(repo)
checkFatal(t, err)
@@ -62,6 +69,18 @@ func TestClonedBranches(t *testing.T) {
{branches["branch"], BranchStatus{
Name: "branch",
IsRemote: false,
HasUpstream: true,
Ahead: 1,
NeedsPush: true,
}},
{branches["origin/branch"], BranchStatus{
Name: "origin/branch",
IsRemote: true,
HasUpstream: false,
}},
{branches["local"], BranchStatus{
Name: "local",
IsRemote: false,
HasUpstream: false,
}},
}