@@ -41,9 +41,9 @@ func TestGetCommits(t *testing.T) {
41
41
{
42
42
testName : "should return no commits if there are none" ,
43
43
logOrder : "topo-order" ,
44
- opts : GetCommitsOptions {RefName : "HEAD" , RefForPushedStatus : "mybranch" , IncludeRebaseCommits : false },
44
+ opts : GetCommitsOptions {RefName : "HEAD" , RefForPushedStatus : & models. Branch { Name : "mybranch" } , IncludeRebaseCommits : false },
45
45
runner : oscommands .NewFakeRunner (t ).
46
- ExpectGitArgs ([]string {"merge-base" , "mybranch" , "mybranch@{u}" }, "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164" , nil ).
46
+ ExpectGitArgs ([]string {"merge-base" , "refs/heads/ mybranch" , "mybranch@{u}" }, "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164" , nil ).
47
47
ExpectGitArgs ([]string {"log" , "HEAD" , "--topo-order" , "--oneline" , "--pretty=format:+%H%x00%at%x00%aN%x00%ae%x00%P%x00%m%x00%D%x00%s" , "--abbrev=40" , "--no-show-signature" , "--" }, "" , nil ),
48
48
49
49
expectedCommitOpts : []models.NewCommitOpts {},
@@ -52,7 +52,7 @@ func TestGetCommits(t *testing.T) {
52
52
{
53
53
testName : "should use proper upstream name for branch" ,
54
54
logOrder : "topo-order" ,
55
- opts : GetCommitsOptions {RefName : "refs/heads/mybranch" , RefForPushedStatus : "refs/heads/ mybranch" , IncludeRebaseCommits : false },
55
+ opts : GetCommitsOptions {RefName : "refs/heads/mybranch" , RefForPushedStatus : & models. Branch { Name : " mybranch"} , IncludeRebaseCommits : false },
56
56
runner : oscommands .NewFakeRunner (t ).
57
57
ExpectGitArgs ([]string {"merge-base" , "refs/heads/mybranch" , "mybranch@{u}" }, "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164" , nil ).
58
58
ExpectGitArgs ([]string {"log" , "refs/heads/mybranch" , "--topo-order" , "--oneline" , "--pretty=format:+%H%x00%at%x00%aN%x00%ae%x00%P%x00%m%x00%D%x00%s" , "--abbrev=40" , "--no-show-signature" , "--" }, "" , nil ),
@@ -63,11 +63,11 @@ func TestGetCommits(t *testing.T) {
63
63
{
64
64
testName : "should return commits if they are present" ,
65
65
logOrder : "topo-order" ,
66
- opts : GetCommitsOptions {RefName : "HEAD" , RefForPushedStatus : "mybranch" , IncludeRebaseCommits : false },
66
+ opts : GetCommitsOptions {RefName : "HEAD" , RefForPushedStatus : & models. Branch { Name : "mybranch" } , IncludeRebaseCommits : false },
67
67
mainBranches : []string {"master" , "main" , "develop" },
68
68
runner : oscommands .NewFakeRunner (t ).
69
69
// here it's seeing which commits are yet to be pushed
70
- ExpectGitArgs ([]string {"merge-base" , "mybranch" , "mybranch@{u}" }, "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164" , nil ).
70
+ ExpectGitArgs ([]string {"merge-base" , "refs/heads/ mybranch" , "mybranch@{u}" }, "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164" , nil ).
71
71
// here it's actually getting all the commits in a formatted form, one per line
72
72
ExpectGitArgs ([]string {"log" , "HEAD" , "--topo-order" , "--oneline" , "--pretty=format:+%H%x00%at%x00%aN%x00%ae%x00%P%x00%m%x00%D%x00%s" , "--abbrev=40" , "--no-show-signature" , "--" }, commitsOutput , nil ).
73
73
// here it's testing which of the configured main branches have an upstream
@@ -199,11 +199,11 @@ func TestGetCommits(t *testing.T) {
199
199
{
200
200
testName : "should not call merge-base for mainBranches if none exist" ,
201
201
logOrder : "topo-order" ,
202
- opts : GetCommitsOptions {RefName : "HEAD" , RefForPushedStatus : "mybranch" , IncludeRebaseCommits : false },
202
+ opts : GetCommitsOptions {RefName : "HEAD" , RefForPushedStatus : & models. Branch { Name : "mybranch" } , IncludeRebaseCommits : false },
203
203
mainBranches : []string {"master" , "main" },
204
204
runner : oscommands .NewFakeRunner (t ).
205
205
// here it's seeing which commits are yet to be pushed
206
- ExpectGitArgs ([]string {"merge-base" , "mybranch" , "mybranch@{u}" }, "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164" , nil ).
206
+ ExpectGitArgs ([]string {"merge-base" , "refs/heads/ mybranch" , "mybranch@{u}" }, "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164" , nil ).
207
207
// here it's actually getting all the commits in a formatted form, one per line
208
208
ExpectGitArgs ([]string {"log" , "HEAD" , "--topo-order" , "--oneline" , "--pretty=format:+%H%x00%at%x00%aN%x00%ae%x00%P%x00%m%x00%D%x00%s" , "--abbrev=40" , "--no-show-signature" , "--" }, singleCommitOutput , nil ).
209
209
// here it's testing which of the configured main branches exist; neither does
@@ -235,11 +235,11 @@ func TestGetCommits(t *testing.T) {
235
235
{
236
236
testName : "should call merge-base for all main branches that exist" ,
237
237
logOrder : "topo-order" ,
238
- opts : GetCommitsOptions {RefName : "HEAD" , RefForPushedStatus : "mybranch" , IncludeRebaseCommits : false },
238
+ opts : GetCommitsOptions {RefName : "HEAD" , RefForPushedStatus : & models. Branch { Name : "mybranch" } , IncludeRebaseCommits : false },
239
239
mainBranches : []string {"master" , "main" , "develop" , "1.0-hotfixes" },
240
240
runner : oscommands .NewFakeRunner (t ).
241
241
// here it's seeing which commits are yet to be pushed
242
- ExpectGitArgs ([]string {"merge-base" , "mybranch" , "mybranch@{u}" }, "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164" , nil ).
242
+ ExpectGitArgs ([]string {"merge-base" , "refs/heads/ mybranch" , "mybranch@{u}" }, "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164" , nil ).
243
243
// here it's actually getting all the commits in a formatted form, one per line
244
244
ExpectGitArgs ([]string {"log" , "HEAD" , "--topo-order" , "--oneline" , "--pretty=format:+%H%x00%at%x00%aN%x00%ae%x00%P%x00%m%x00%D%x00%s" , "--abbrev=40" , "--no-show-signature" , "--" }, singleCommitOutput , nil ).
245
245
// here it's testing which of the configured main branches exist
@@ -273,9 +273,9 @@ func TestGetCommits(t *testing.T) {
273
273
{
274
274
testName : "should not specify order if `log.order` is `default`" ,
275
275
logOrder : "default" ,
276
- opts : GetCommitsOptions {RefName : "HEAD" , RefForPushedStatus : "mybranch" , IncludeRebaseCommits : false },
276
+ opts : GetCommitsOptions {RefName : "HEAD" , RefForPushedStatus : & models. Branch { Name : "mybranch" } , IncludeRebaseCommits : false },
277
277
runner : oscommands .NewFakeRunner (t ).
278
- ExpectGitArgs ([]string {"merge-base" , "mybranch" , "mybranch@{u}" }, "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164" , nil ).
278
+ ExpectGitArgs ([]string {"merge-base" , "refs/heads/ mybranch" , "mybranch@{u}" }, "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164" , nil ).
279
279
ExpectGitArgs ([]string {"log" , "HEAD" , "--oneline" , "--pretty=format:+%H%x00%at%x00%aN%x00%ae%x00%P%x00%m%x00%D%x00%s" , "--abbrev=40" , "--no-show-signature" , "--" }, "" , nil ),
280
280
281
281
expectedCommitOpts : []models.NewCommitOpts {},
@@ -284,9 +284,9 @@ func TestGetCommits(t *testing.T) {
284
284
{
285
285
testName : "should set filter path" ,
286
286
logOrder : "default" ,
287
- opts : GetCommitsOptions {RefName : "HEAD" , RefForPushedStatus : "mybranch" , FilterPath : "src" },
287
+ opts : GetCommitsOptions {RefName : "HEAD" , RefForPushedStatus : & models. Branch { Name : "mybranch" } , FilterPath : "src" },
288
288
runner : oscommands .NewFakeRunner (t ).
289
- ExpectGitArgs ([]string {"merge-base" , "mybranch" , "mybranch@{u}" }, "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164" , nil ).
289
+ ExpectGitArgs ([]string {"merge-base" , "refs/heads/ mybranch" , "mybranch@{u}" }, "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164" , nil ).
290
290
ExpectGitArgs ([]string {"log" , "HEAD" , "--oneline" , "--pretty=format:+%H%x00%at%x00%aN%x00%ae%x00%P%x00%m%x00%D%x00%s" , "--abbrev=40" , "--follow" , "--name-status" , "--no-show-signature" , "--" , "src" }, "" , nil ),
291
291
292
292
expectedCommitOpts : []models.NewCommitOpts {},
0 commit comments