feat(git): only generate line numbers > 0 (#1898)
This commit is contained in:
@@ -158,6 +158,11 @@ func UpdateLinkLineNumber(ctx context.Context, link string, newLine int64) strin
|
||||
return link
|
||||
}
|
||||
|
||||
if newLine <= 0 {
|
||||
// Don't change the link if the line number is 0.
|
||||
return link
|
||||
}
|
||||
|
||||
switch determineProvider(link) {
|
||||
case providerBitbucket:
|
||||
// For Bitbucket, it doesn't support line links (based on the GenerateLink function).
|
||||
|
||||
@@ -251,6 +251,14 @@ func TestUpdateLinkLineNumber(t *testing.T) {
|
||||
},
|
||||
want: "https://onprem.customdomain.com/org/repo/commit/xyz123#L50",
|
||||
},
|
||||
{
|
||||
name: "Don't include line when it's 0",
|
||||
args: args{
|
||||
link: "https://github.com/coinbase/cbpay-js/issues/181",
|
||||
newLine: int64(0),
|
||||
},
|
||||
want: "https://github.com/coinbase/cbpay-js/issues/181",
|
||||
},
|
||||
{
|
||||
name: "Invalid link",
|
||||
args: args{
|
||||
|
||||
Reference in New Issue
Block a user