6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-08 15:44:18 +00:00

Count commits ahead and behind the upstream branch

This commit is contained in:
Grzegorz Dlugoszewski
2020-06-08 17:16:46 +02:00
parent ee26ddc38f
commit 4765d943ec
5 changed files with 108 additions and 102 deletions

View File

@@ -34,10 +34,10 @@ func TestStatus(t *testing.T) {
CurrentBranch: "master",
Branches: []*BranchStatus{
{
Name: "master",
Upstream: "",
NeedsPull: false,
NeedsPush: false,
Name: "master",
Upstream: "",
Behind: 0,
Ahead: 0,
},
},
}},
@@ -47,10 +47,10 @@ func TestStatus(t *testing.T) {
CurrentBranch: "master",
Branches: []*BranchStatus{
{
Name: "master",
Upstream: "",
NeedsPull: false,
NeedsPush: false,
Name: "master",
Upstream: "",
Behind: 0,
Ahead: 0,
},
},
}},
@@ -60,10 +60,10 @@ func TestStatus(t *testing.T) {
CurrentBranch: "master",
Branches: []*BranchStatus{
{
Name: "master",
Upstream: "",
NeedsPull: false,
NeedsPush: false,
Name: "master",
Upstream: "",
Behind: 0,
Ahead: 0,
},
},
}},
@@ -73,15 +73,15 @@ func TestStatus(t *testing.T) {
CurrentBranch: "master",
Branches: []*BranchStatus{
{
Name: "master",
Upstream: "",
NeedsPull: false,
NeedsPush: false,
Name: "master",
Upstream: "",
Behind: 0,
Ahead: 0,
}, {
Name: "local",
Upstream: "",
NeedsPull: false,
NeedsPush: false,
Name: "local",
Upstream: "",
Behind: 0,
Ahead: 0,
},
},
}},
@@ -91,15 +91,15 @@ func TestStatus(t *testing.T) {
CurrentBranch: "local",
Branches: []*BranchStatus{
{
Name: "master",
Upstream: "origin/master",
NeedsPull: false,
NeedsPush: false,
Name: "master",
Upstream: "origin/master",
Behind: 0,
Ahead: 0,
}, {
Name: "local",
Upstream: "",
NeedsPull: false,
NeedsPush: false,
Name: "local",
Upstream: "",
Behind: 0,
Ahead: 0,
},
},
}},
@@ -109,10 +109,10 @@ func TestStatus(t *testing.T) {
CurrentBranch: StatusDetached,
Branches: []*BranchStatus{
{
Name: "master",
Upstream: "",
NeedsPull: false,
NeedsPush: false,
Name: "master",
Upstream: "",
Behind: 0,
Ahead: 0,
},
},
}},
@@ -122,10 +122,10 @@ func TestStatus(t *testing.T) {
CurrentBranch: "master",
Branches: []*BranchStatus{
{
Name: "master",
Upstream: "origin/master",
NeedsPull: false,
NeedsPush: true,
Name: "master",
Upstream: "origin/master",
Behind: 0,
Ahead: 1,
},
},
}},
@@ -135,10 +135,10 @@ func TestStatus(t *testing.T) {
CurrentBranch: "master",
Branches: []*BranchStatus{
{
Name: "master",
Upstream: "origin/master",
NeedsPull: true,
NeedsPush: false,
Name: "master",
Upstream: "origin/master",
Behind: 1,
Ahead: 0,
},
},
}},
@@ -148,10 +148,10 @@ func TestStatus(t *testing.T) {
CurrentBranch: "master",
Branches: []*BranchStatus{
{
Name: "master",
Upstream: "origin/master",
NeedsPull: true,
NeedsPush: true,
Name: "master",
Upstream: "origin/master",
Behind: 3,
Ahead: 2,
},
},
}},