File tree Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 9393 "minimum" : 7 ,
9494 "maximum" : 40
9595 },
96+ "gitblame.isWebPathPlural" : {
97+ "type" : " boolean" ,
98+ "default" : false ,
99+ "description" : " BitBucket uses commits instead of commit in their web interface. Turn this on if you want the View button to work for BitBucket."
100+ },
96101 "gitblame.logLevel" : {
97102 "type" : " array" ,
98103 "default" : [
Original file line number Diff line number Diff line change @@ -113,10 +113,14 @@ export class GitBlame {
113113 }
114114 }
115115
116- public defaultWebPath ( url : string , hash : string ) : string {
116+ public defaultWebPath (
117+ url : string ,
118+ hash : string ,
119+ isPlural : boolean ,
120+ ) : string {
117121 return url . replace (
118122 / ^ ( g i t @ | h t t p s : \/ \/ ) ( [ ^ : \/ ] + ) [: \/ ] ( .* ) \. g i t $ / ,
119- `https://$2/$3/commit/${ hash } ` ,
123+ `https://$2/$3/${ isPlural ? " commit" : "commits" } /${ hash } ` ,
120124 ) ;
121125 }
122126
@@ -239,12 +243,18 @@ export class GitBlame {
239243 } ,
240244 ) ;
241245
246+ const isWebPathPlural = Property . get ( Properties . IsWebPathPlural , false ) ;
247+
242248 if ( isWebUri ( parsedUrl ) ) {
243249 return Uri . parse ( parsedUrl ) ;
244250 } else if ( parsedUrl === "guess" ) {
245251 const origin = await this . getOriginOfActiveFile ( ) ;
246252 if ( origin ) {
247- const uri = this . defaultWebPath ( origin , commitInfo . hash ) ;
253+ const uri = this . defaultWebPath (
254+ origin ,
255+ commitInfo . hash ,
256+ isWebPathPlural ,
257+ ) ;
248258 return Uri . parse ( uri ) ;
249259 } else {
250260 return ;
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ export enum Properties {
55 IgnoreWhitespace = "ignoreWhitespace" ,
66 InfoMessageFormat = "infoMessageFormat" ,
77 InternalHashLength = "internalHashLength" ,
8+ IsWebPathPlural = "isWebPathPlural" ,
89 LogLevel = "logLevel" ,
910 ProgressSpinner = "progressSpinner" ,
1011 StatusBarMessageFormat = "statusBarMessageFormat" ,
@@ -78,6 +79,9 @@ export class Property {
7879 internalHashLength : this . getPropertyFromConfiguration (
7980 Properties . InternalHashLength ,
8081 ) ,
82+ isWebPathPlural : this . getPropertyFromConfiguration (
83+ Properties . IsWebPathPlural ,
84+ ) ,
8185 logLevel : this . getPropertyFromConfiguration (
8286 Properties . LogLevel ,
8387 ) ,
You can’t perform that action at this time.
0 commit comments