File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -303,10 +303,10 @@ func (p *GitPlugin) buildScanOptions() string {
303303 options = append (options , "--all" )
304304 }
305305
306- // If base commit is specified, use commit range instead of depth
307306 if p .baseCommit != "" {
308307 options = append (options , fmt .Sprintf ("%s..HEAD" , p .baseCommit ))
309- } else if p .depth > 0 {
308+ }
309+ if p .depth > 0 {
310310 options = append (options , fmt .Sprintf ("-n %d" , p .depth ))
311311 }
312312
Original file line number Diff line number Diff line change @@ -71,18 +71,18 @@ func TestBuildScanOptions(t *testing.T) {
7171 expectedOptions : "--full-history --all def456..HEAD" ,
7272 },
7373 {
74- name : "Base commit takes precedence over depth " ,
74+ name : "Base commit with depth: both flags are used " ,
7575 scanAllBranches : false ,
7676 depth : 10 ,
7777 baseCommit : "ghi789" ,
78- expectedOptions : "--full-history ghi789..HEAD" ,
78+ expectedOptions : "--full-history ghi789..HEAD -n 10 " ,
7979 },
8080 {
81- name : "Base commit with all branches takes precedence over depth " ,
81+ name : "Base commit with all branches and depth: all flags are used " ,
8282 scanAllBranches : true ,
8383 depth : 15 ,
8484 baseCommit : "jkl012" ,
85- expectedOptions : "--full-history --all jkl012..HEAD" ,
85+ expectedOptions : "--full-history --all jkl012..HEAD -n 15 " ,
8686 },
8787 }
8888
You can’t perform that action at this time.
0 commit comments