Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configured remotes not showing up in quickpick menu when opening commit on remote #1449

Closed
IvanRadakovic opened this issue Mar 30, 2021 · 22 comments
Assignees
Labels
needs-verification Request for verification
Milestone

Comments

@IvanRadakovic
Copy link

I set the output level to debug, but it doesn't output anything.

  • GitLens Version: 2021.3.1104
  • Git Version: 2.28.0
  • VSCode Version: 1.54.3
  • OS Version: macOS 11.2.3

Steps to Reproduce:

  1. set gitlens.integrations.enabled to true
  2. Based on https://github.com/eamodio/vscode-gitlens#remote-provider-integration-settings- add this to settings
    "gitlens.remotes": [{
    "domain": "code.company.com",
    "type": "Custom",
    "name": "company",
    "protocol": "https",
    "urls": {
    "repository": "https://code.company.com/packages/${repo}",
    "branches": "https://code.company.com/packages/${repo}/repo-info",
    "branch": "https://code.company.com/packages/${repo}/trees/heads/${branch}",
    "commit": "https://code.company.com/packages/${repo}/commits/${id}",
    "file": "https://code.company.com/packages/${repo}?path=${file}${line}",
    "fileInBranch": "https://code.company.com/packages/${repo}/blobs/${branch}/--/${file}${line}",
    "fileInCommit": "https://code.company.com/packages/${repo}/blobs/${id}/--/${file}${line}",
    "fileLine": "#L${line}",
    "fileRange": "#L${start}-L${end}"
    }
    }],
  3. Save
  4. Restart VS Code
  5. Go to COMMITS tab in source controll.
  6. Click 'Open Commit on Remote' next to a commit

Expected: opens commit on the configured remote.
Actual: 'No auto-detected or configured remote providers found' shows up in quickpick menu as if nothing was ever configured

@IvanRadakovic IvanRadakovic added potential-bug triage Needs to be looked at labels Mar 30, 2021
@sarthak-k
Copy link

Yup, experiencing this.

@eamodio
Copy link
Member

eamodio commented Apr 6, 2021

Can either of you post what the output of git remote -vv returns? Because the domain of the custom remote definition has to match the domain of your Git remote.

@eamodio eamodio added needs-more-info Needs further information, steps, details, etc. and removed triage Needs to be looked at labels Apr 6, 2021
@sarthak-k
Copy link

Certainly, it's different. But the purpose with Custom remote should enable us to add any domain, I believe we should treat this as a bug.

@IvanRadakovic
Copy link
Author

So the domain and git remote -vv are different, but I was under the impression that this would still allow us to open a webpage in the browser using this template: https://code.company.com/packages/${repo}/commits/${id} with the repo and id fillied in from that corresponding commit.

@eamodio
Copy link
Member

eamodio commented Apr 6, 2021

The gitlens.remotes property allows you to configure custom remote "matchers", so GitLens can use those configured custom remotes in addition to its built-in remote support for GitHub, Bitbucket, etc, to match against your repository remotes. If a match is found, then the urls configuration is used to open resources. So the domain property or the newly added regex property must be specified to perform that match.

@IvanRadakovic
Copy link
Author

Ah I see. That makes sense. I ran into another issue. So git remote -vv shows this

backup  ssh://git.company.com:2222/pkg/RepoName/backup/username (fetch)
backup  ssh://git.company.com:2222/pkg/RepoName/backup/username (push)
origin  ssh://git.company.com:2222/pkg/RepoName (fetch)
origin  ssh://git.company.com:2222/pkg/RepoName (push)
share   ssh://git.company.com:2222/pkg/RepoName/share/username (fetch)

I have changed the domain to be git.company.com. However now ${repo} in the URL resolves to pkg/RepoName(https://code.company.com/packages/pkg/RepoName) instead of just RepoName (https://code.company.com/packages/RepoName).

@eamodio
Copy link
Member

eamodio commented Apr 7, 2021

So for that you'll need to use the regex property instead of domain and the first capture group is the domain part and the 2nd capture group is the repo

@github-actions
Copy link

This issue needs more information and has not had recent activity. Please provide the missing information or it will be closed in 7 days. Thanks!

@github-actions github-actions bot added the inactive Issue has not had recent required feedback label Apr 15, 2021
@zainfathoni
Copy link

zainfathoni commented Apr 20, 2021

So for that you'll need to use the regex property instead of domain and the first capture group is the domain part and the 2nd capture group is the repo

@eamodio I am facing the same issue here. Could you please provide an example? I couldn't find it in the README.md document. Thanks!

@github-actions github-actions bot removed the inactive Issue has not had recent required feedback label Apr 20, 2021
@IvanRadakovic
Copy link
Author

For this domain
origin ssh://git.company.com:2222/pkg/RepoName (fetch)

I tried

"regex": "ssh:\\/\\/(git.company.com):2222\\/pkg\\/(\\w+)"
"regex": "(ssh:\\/\\/git.company.com:2222)\\/pkg\\/(\\w+)"
"regex": "ssh:\/\/(git.company.com):2222\/pkg\/(\\w+)"
"regex": "(ssh:\/\/git.company.com:2222)\/pkg\/(\\w+)"

and none of them work. Could you please add documentation in the README.md on how use the regex property with some examples.

@github-actions
Copy link

This issue needs more information and has not had recent activity. Please provide the missing information or it will be closed in 7 days. Thanks!

@github-actions github-actions bot added the inactive Issue has not had recent required feedback label Apr 29, 2021
@objectiveryan
Copy link

I have the original problem (No auto-detected or configured remote providers found). I have several equivalent remotes defined (for configuration reasons), and my employer has a custom protocol (sso), could either of those cause the problem?

$ git remote -vv
origin  sso://our-domain/repo-name (fetch)
origin  sso://our-domain/repo-name (push)
origin-3.2.0-hotfixes   sso://our-domain/repo-name (fetch)
origin-3.2.0-hotfixes   sso://our-domain/repo-name (push)
origin-v3.0.0   sso://our-domain/repo-name (fetch)
origin-v3.0.0   sso://our-domain/repo-name (push)
...

settings.json:

    "gitlens.integrations.enabled": true,
    "gitlens.remotes": [{
        "domain": "our-domain",
        "type": "Custom",
        "name": "Company Name",
        "protocol": "sso",
        "urls": {
            "repository": "...",
            "branches": "...",
            "branch": "...",
            "commit": "...",
            "file": "...",
            "fileInBranch": "...",
            "fileInCommit": "...",
            "fileLine": "...",
            "fileRange": "..."
        }
    }]

@github-actions github-actions bot removed the inactive Issue has not had recent required feedback label May 6, 2021
@github-actions
Copy link

This issue needs more information and has not had recent activity. Please provide the missing information or it will be closed in 7 days. Thanks!

@github-actions github-actions bot added the inactive Issue has not had recent required feedback label May 13, 2021
@objectiveryan
Copy link

Is there some more information I can provide? I don't want this issue to be closed – it still affects me.

@priteshacharya
Copy link

This also affects me, It used to work before but doesn't anymore, what information do you need?

@github-actions github-actions bot removed the inactive Issue has not had recent required feedback label May 18, 2021
@eamodio eamodio removed the needs-more-info Needs further information, steps, details, etc. label May 23, 2021
@objectiveryan
Copy link

FYI I tried removing my other remotes, so there's only one:

$ git remote -vv
origin  sso://our-domain/repo-name (fetch)
origin  sso://our-domain/repo-name (push)
$

I've tried setting gitlens.integrations.enabled and gitlens.remotes in my user settings and/or workspace settings (first one, then both, then only the other). I quit and restart VSCode. I still get "No auto-detected or configured remote providers found" :-(

Also, I typically ssh into a remote server to work (through VSCode's Remote - SSH extension), but I tried working out of a local folder and had the same problem.

@lodotek
Copy link

lodotek commented Jun 11, 2021

Bump. Having the same issue here trying to use Bitbucket with GitLens. :-(

@eamodio eamodio self-assigned this Jun 15, 2021
@eamodio eamodio added the bug label Jun 15, 2021
@eamodio eamodio added this to the Soon™ milestone Jun 15, 2021
@eamodio
Copy link
Member

eamodio commented Jun 15, 2021

Sorry for the delay and confusion around this issue. I think I've gotten to the bottom of it, and I added 2 new examples in the README that use the regex property.

Can you please verify this fix in tomorrow's GitLens insiders edition?

You can install the GitLens insiders edition from here. Be sure to disable/uninstall the stable version of GitLens first.

@eamodio eamodio added needs-verification Request for verification pending-release Resolved but not yet released to the stable edition labels Jun 15, 2021
@IvanRadakovic
Copy link
Author

IvanRadakovic commented Jun 23, 2021

Hey thank you so much for the fix!

It works for me. However, I got an Invalid escape character in string error when using what you had in the README example:

"ssh:\/\/(my\.company\.com):1234\/git\/(.+)"

This is because \. is not a valid escape character in JSON. This caused me to dig deeper into what is actually required.
To make it work, you could replace \. with just .

"ssh:\/\/(my.company.com):1234\/git\/(.+)"

which works, but it could match other incorrect strings as well because of the wild card.
A better fix would be to properly escape the \ by replacing \. with \\.

"ssh:\/\/(my\\.company\\.com):1234\/git\/(.+)"

I also found out that in JSON, you can, but are not required to escape /. \/ is just as valid as /. Allowing \/ helps when embedding JSON in a <script> tag, which doesn't allow </ inside strings. So this means that the example in the README could be simplified to only escape the . with two \ and leaving everything else alone.

"ssh://(my\\.company\\.com):1234/git/(.+)"

@eamodio
Copy link
Member

eamodio commented Jun 28, 2021

Thanks, I've fixed the example.

@eamodio eamodio removed the pending-release Resolved but not yet released to the stable edition label Jul 13, 2021
@eamodio eamodio modified the milestones: Soon™, Shipped Jul 13, 2021
@blindside85
Copy link

blindside85 commented Jul 23, 2021

Hi @eamodio , I'm having issues in a similar vein to the above users, and I think the regex option might be the key, but I can't seem to find any docs explaining how it works, only some examples silently using it.

A few questions I think might be handy to explain about the regex option:

  1. What exactly does it do / allow in the remotes configuration?
  2. What are the capture groups for? For example: (my\\.company\\.com) and (.+)
  3. Is the option specific to ssh-related URLs, or would http/https URLs also work?
  4. Should the regex option be used in place of the domain option, or together with it?

To be a little more specific, my company's remote URLs contain spaces, represented in the URL string by %20. This is showing up in Gitlens' generated remote URLs as %2520, which leads to missing/incorrect links.

If there are already docs explaining all this, if someone could link to those I'd appreciate it, I wasn't able to find them 😞

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs-verification Request for verification
Projects
None yet
Development

No branches or pull requests

8 participants