Skip to content

Commit 0e8fcbc

Browse files
committed
close #79 remove remote from upnext
1 parent 75ab7c8 commit 0e8fcbc

File tree

3 files changed

+41
-9
lines changed

3 files changed

+41
-9
lines changed

ci/notes/CHANGELOG.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
Last release brought some unexpected problems with our authentication og permissions to github, whoops.
2-
We have made a fix for theses problems, so just go ahead and get the update and these problems should be a part of the past.
3-
To re-authenticate you need to delete the old 'git phlow' token on github.com and delete your phlow settings in your global .gitconfig file.
1+
We have changed to agent upnext command so automation becomes easier, this is a quickfix and non critical
2+
for users who uses do not use the agent commandset.
3+
4+
5+
#### Patch
6+
- upnext returns a name ready for checkout #79 @groenborg
47

5-
#### Bug fixes
6-
- phlow can be authenticated on multiple machines #72 @groenborg
7-
- list issues should now work on private repositories #71 @groenborg
8-
- build environment should work on newest go version #73 @groenborg

phlow/phlow_test.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,27 @@ func TestUpNext(t *testing.T) {
2525
Convey("Testing output of clean function", func() {
2626
branches := githandler.BranchReady("origin")
2727
res := getNextBranch(branches)
28+
So(res, ShouldEqual, "ready/15-issue-branch")
29+
})
30+
31+
testfixture.RemoveTestRepository(t)
32+
33+
})
34+
}
35+
36+
func TestRemoveRemoteFromName(t *testing.T) {
37+
Convey("Running tests on 'remoteRemoteFromName' function", t, func() {
38+
39+
testfixture.CreateTestRepository(t, false)
40+
41+
Convey("origin should be removed", func() {
42+
branches := githandler.BranchReady("origin")
43+
res := getNextBranch(branches)
44+
res = removeRemoteFromUpNext(res)
45+
46+
t.Log(res)
2847

29-
So(res, ShouldEqual, "origin/ready/15-issue-branch")
48+
So(res, ShouldEqual, "ready/15-issue-branch")
3049
})
3150

3251
testfixture.RemoveTestRepository(t)

phlow/upnext.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77

88
"github.com/praqma/git-phlow/githandler"
99
"github.com/praqma/git-phlow/options"
10+
"strings"
1011
)
1112

1213
//UpNext ...
@@ -58,7 +59,20 @@ func getNextBranch(branches []string) string {
5859
sort.Ints(keys)
5960

6061
if len(keys) > 0 {
61-
return m[keys[0]]
62+
res := removeRemoteFromUpNext(m[keys[0]])
63+
return res
6264
}
6365
return ""
6466
}
67+
68+
//remoteRemoteFromUpNext ...
69+
func removeRemoteFromUpNext(name string) string {
70+
71+
remote := githandler.ConfigBranchRemote("master")
72+
73+
if strings.HasPrefix(name, remote+"/") {
74+
name = strings.TrimPrefix(name, remote+"/")
75+
return name
76+
}
77+
return name
78+
}

0 commit comments

Comments
 (0)