GitLink icon indicating copy to clipboard operation
GitLink copied to clipboard

With Custom Repo when `Check remote` is disabled the link generated is always with the commit ID in URL

Open gkns opened this issue 1 year ago • 4 comments

My remote is Gerrit for review purposes, however, when I generate the link, I want it to point to the GitLab repo; Hence I have a custom domain configuration.

Since my repo is large, I have disabled the Check remote as recommended by the plugin.

But with the above changes, The link generated by Open in GitlabVMW (GitlabVMW is my custom domain configuration which is described below) will always have a commit ID in the file path. This commit ID will not exist in remote since the commit IDs will be different for Gerrit and Gitlab; Making the link 404. Eg link generated: https://gitlab.eng.vmware.com/core-build/repo/-/blob/0361d35bb144cdeaf534a2b1dc03fd19d6af23e5/File.java#L116-L116

I think this is a bug that has to do with the Check remote feature.

My custom domain configuration is as follows:

// File at branch template : 
https://gitlab.eng.vmware.com/core-build/{remote:url:path:0}/-/blob/{branch}/{file:path}/{file:name}#L{line:start}-L{line:end}{line-block:end}

// File at commit template: 
https://gitlab.eng.vmware.com/core-build/{remote:url:path:1}/-/blob/{commit}/{file:name}{line-block:start}#L{line:start}-L{line:end}{line-block:end}

// Commit Template:
https://gitlab.eng.vmware.com/core-build/{remote:url:path:1}/-/commit/{commit}

Am I missing anything or can this be fixed?

gkns avatar Nov 24 '22 16:11 gkns