File tree Expand file tree Collapse file tree 2 files changed +34
-3
lines changed
components/server/src/bitbucket-server Expand file tree Collapse file tree 2 files changed +34
-3
lines changed Original file line number Diff line number Diff line change @@ -186,6 +186,33 @@ class TestBitbucketServerContextParser {
186
186
} ) ;
187
187
}
188
188
189
+ @test async test_branch_context_01 ( ) {
190
+ const result = await this . parser . handle (
191
+ { } ,
192
+ this . user ,
193
+ "https://bitbucket.gitpod-dev.com/users/svenefftinge/repos/browser-extension-test/commits?until=refs%2Fheads%2Fmy-branch&merges=include" ,
194
+ ) ;
195
+
196
+ expect ( result ) . to . deep . include ( {
197
+ ref : "my-branch" ,
198
+ refType : "branch" ,
199
+ revision : "3ca42b45bc693973cb21a112a418c13f8b4d11a5" ,
200
+ path : "" ,
201
+ isFile : false ,
202
+ repository : {
203
+ cloneUrl : "https://bitbucket.gitpod-dev.com/scm/~svenefftinge/browser-extension-test.git" ,
204
+ defaultBranch : "main" ,
205
+ host : "bitbucket.gitpod-dev.com" ,
206
+ name : "browser-extension-test" ,
207
+ owner : "svenefftinge" ,
208
+ repoKind : "users" ,
209
+ private : false ,
210
+ webUrl : "https://bitbucket.gitpod-dev.com/users/svenefftinge/repos/browser-extension-test" ,
211
+ } ,
212
+ title : "svenefftinge/browser-extension-test - my-branch" ,
213
+ } ) ;
214
+ }
215
+
189
216
@test async test_PR_context_01 ( ) {
190
217
const result = await this . parser . handle (
191
218
{ } ,
Original file line number Diff line number Diff line change @@ -35,6 +35,10 @@ export class BitbucketServerContextParser extends AbstractContextParser implemen
35
35
const branchName = this . toSimpleBranchName ( decodeURIComponent ( searchParams . get ( "at" ) ! ) ) ;
36
36
more . ref = branchName ;
37
37
more . refType = "branch" ;
38
+ } else if ( searchParams . has ( "until" ) ) {
39
+ const branchName = this . toSimpleBranchName ( decodeURIComponent ( searchParams . get ( "until" ) ! ) ) ;
40
+ more . ref = branchName ;
41
+ more . refType = "branch" ;
38
42
}
39
43
40
44
if ( moreSegments [ 0 ] === "pull-requests" && ! ! moreSegments [ 1 ] ) {
@@ -72,11 +76,11 @@ export class BitbucketServerContextParser extends AbstractContextParser implemen
72
76
73
77
const host = this . host ; // as per contract, cf. `canHandle(user, contextURL)`
74
78
75
- const lenghtOfRelativePath = host . split ( "/" ) . length - 1 ; // e.g. "123.123.123.123/gitlab" => length of 1
76
- if ( lenghtOfRelativePath > 0 ) {
79
+ const lengthOfRelativePath = host . split ( "/" ) . length - 1 ; // e.g. "123.123.123.123/gitlab" => length of 1
80
+ if ( lengthOfRelativePath > 0 ) {
77
81
// remove segments from the path to be consider further, which belong to the relative location of the host
78
82
// cf. https://github.com/gitpod-io/gitpod/issues/2637
79
- segments . splice ( 0 , lenghtOfRelativePath ) ;
83
+ segments . splice ( 0 , lengthOfRelativePath ) ;
80
84
}
81
85
82
86
const firstSegment = segments [ 0 ] ;
You can’t perform that action at this time.
0 commit comments