@@ -33,17 +33,15 @@ func TestGetCommits(t *testing.T) {
33
33
expectedCommits []* models.Commit
34
34
expectedError error
35
35
logOrder string
36
- rebaseMode enums.RebaseMode
37
36
opts GetCommitsOptions
38
37
mainBranches []string
39
38
}
40
39
41
40
scenarios := []scenario {
42
41
{
43
- testName : "should return no commits if there are none" ,
44
- logOrder : "topo-order" ,
45
- rebaseMode : enums .REBASE_MODE_NONE ,
46
- opts : GetCommitsOptions {RefName : "HEAD" , RefForPushedStatus : "mybranch" , IncludeRebaseCommits : false },
42
+ testName : "should return no commits if there are none" ,
43
+ logOrder : "topo-order" ,
44
+ opts : GetCommitsOptions {RefName : "HEAD" , RefForPushedStatus : "mybranch" , IncludeRebaseCommits : false },
47
45
runner : oscommands .NewFakeRunner (t ).
48
46
ExpectGitArgs ([]string {"merge-base" , "mybranch" , "mybranch@{u}" }, "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164" , nil ).
49
47
ExpectGitArgs ([]string {"log" , "HEAD" , "--topo-order" , "--oneline" , "--pretty=format:%H%x00%at%x00%aN%x00%ae%x00%D%x00%p%x00%m%x00%s" , "--abbrev=40" , "--no-show-signature" , "--" }, "" , nil ),
@@ -52,10 +50,9 @@ func TestGetCommits(t *testing.T) {
52
50
expectedError : nil ,
53
51
},
54
52
{
55
- testName : "should use proper upstream name for branch" ,
56
- logOrder : "topo-order" ,
57
- rebaseMode : enums .REBASE_MODE_NONE ,
58
- opts : GetCommitsOptions {RefName : "refs/heads/mybranch" , RefForPushedStatus : "refs/heads/mybranch" , IncludeRebaseCommits : false },
53
+ testName : "should use proper upstream name for branch" ,
54
+ logOrder : "topo-order" ,
55
+ opts : GetCommitsOptions {RefName : "refs/heads/mybranch" , RefForPushedStatus : "refs/heads/mybranch" , IncludeRebaseCommits : false },
59
56
runner : oscommands .NewFakeRunner (t ).
60
57
ExpectGitArgs ([]string {"merge-base" , "refs/heads/mybranch" , "mybranch@{u}" }, "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164" , nil ).
61
58
ExpectGitArgs ([]string {"log" , "refs/heads/mybranch" , "--topo-order" , "--oneline" , "--pretty=format:%H%x00%at%x00%aN%x00%ae%x00%D%x00%p%x00%m%x00%s" , "--abbrev=40" , "--no-show-signature" , "--" }, "" , nil ),
@@ -66,7 +63,6 @@ func TestGetCommits(t *testing.T) {
66
63
{
67
64
testName : "should return commits if they are present" ,
68
65
logOrder : "topo-order" ,
69
- rebaseMode : enums .REBASE_MODE_NONE ,
70
66
opts : GetCommitsOptions {RefName : "HEAD" , RefForPushedStatus : "mybranch" , IncludeRebaseCommits : false },
71
67
mainBranches : []string {"master" , "main" , "develop" },
72
68
runner : oscommands .NewFakeRunner (t ).
@@ -203,7 +199,6 @@ func TestGetCommits(t *testing.T) {
203
199
{
204
200
testName : "should not call merge-base for mainBranches if none exist" ,
205
201
logOrder : "topo-order" ,
206
- rebaseMode : enums .REBASE_MODE_NONE ,
207
202
opts : GetCommitsOptions {RefName : "HEAD" , RefForPushedStatus : "mybranch" , IncludeRebaseCommits : false },
208
203
mainBranches : []string {"master" , "main" },
209
204
runner : oscommands .NewFakeRunner (t ).
@@ -240,7 +235,6 @@ func TestGetCommits(t *testing.T) {
240
235
{
241
236
testName : "should call merge-base for all main branches that exist" ,
242
237
logOrder : "topo-order" ,
243
- rebaseMode : enums .REBASE_MODE_NONE ,
244
238
opts : GetCommitsOptions {RefName : "HEAD" , RefForPushedStatus : "mybranch" , IncludeRebaseCommits : false },
245
239
mainBranches : []string {"master" , "main" , "develop" , "1.0-hotfixes" },
246
240
runner : oscommands .NewFakeRunner (t ).
@@ -277,10 +271,9 @@ func TestGetCommits(t *testing.T) {
277
271
expectedError : nil ,
278
272
},
279
273
{
280
- testName : "should not specify order if `log.order` is `default`" ,
281
- logOrder : "default" ,
282
- rebaseMode : enums .REBASE_MODE_NONE ,
283
- opts : GetCommitsOptions {RefName : "HEAD" , RefForPushedStatus : "mybranch" , IncludeRebaseCommits : false },
274
+ testName : "should not specify order if `log.order` is `default`" ,
275
+ logOrder : "default" ,
276
+ opts : GetCommitsOptions {RefName : "HEAD" , RefForPushedStatus : "mybranch" , IncludeRebaseCommits : false },
284
277
runner : oscommands .NewFakeRunner (t ).
285
278
ExpectGitArgs ([]string {"merge-base" , "mybranch" , "mybranch@{u}" }, "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164" , nil ).
286
279
ExpectGitArgs ([]string {"log" , "HEAD" , "--oneline" , "--pretty=format:%H%x00%at%x00%aN%x00%ae%x00%D%x00%p%x00%m%x00%s" , "--abbrev=40" , "--no-show-signature" , "--" }, "" , nil ),
@@ -289,10 +282,9 @@ func TestGetCommits(t *testing.T) {
289
282
expectedError : nil ,
290
283
},
291
284
{
292
- testName : "should set filter path" ,
293
- logOrder : "default" ,
294
- rebaseMode : enums .REBASE_MODE_NONE ,
295
- opts : GetCommitsOptions {RefName : "HEAD" , RefForPushedStatus : "mybranch" , FilterPath : "src" },
285
+ testName : "should set filter path" ,
286
+ logOrder : "default" ,
287
+ opts : GetCommitsOptions {RefName : "HEAD" , RefForPushedStatus : "mybranch" , FilterPath : "src" },
296
288
runner : oscommands .NewFakeRunner (t ).
297
289
ExpectGitArgs ([]string {"merge-base" , "mybranch" , "mybranch@{u}" }, "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164" , nil ).
298
290
ExpectGitArgs ([]string {"log" , "HEAD" , "--oneline" , "--pretty=format:%H%x00%at%x00%aN%x00%ae%x00%D%x00%p%x00%m%x00%s" , "--abbrev=40" , "--follow" , "--no-show-signature" , "--" , "src" }, "" , nil ),
@@ -312,7 +304,7 @@ func TestGetCommits(t *testing.T) {
312
304
builder := & CommitLoader {
313
305
Common : common ,
314
306
cmd : cmd ,
315
- getRebaseMode : func () (enums.RebaseMode , error ) { return scenario . rebaseMode , nil },
307
+ getRebaseMode : func () (enums.RebaseMode , error ) { return enums . REBASE_MODE_NONE , nil },
316
308
dotGitDir : ".git" ,
317
309
readFile : func (filename string ) ([]byte , error ) {
318
310
return []byte ("" ), nil
0 commit comments