Skip to content

Commit

Permalink
Fix: Github ssh remote with non git user name (#52)
Browse files Browse the repository at this point in the history
**Issue:** 
One of commercial projects on github uses remote origin url of the next format:
`[email protected]:testcompany/testproject.git`

Githubinator extension is failing with error `Could not find provider for repo`

**Fix:**
Change Github matcher to support any user name.
  • Loading branch information
galaydaroman authored Oct 13, 2021
1 parent 0b0082f commit 3db1d07
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## 1.1.1 - 2021-10-12

### Fixed

- support Github ssh remote with non `git` username. Thanks @galaydaroman! (#52)

## 1.1.0 - 2021-06-24

### Added
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "githubinator",
"displayName": "Githubinator",
"description": "Quickly open files on Github and other providers. View blame information, copy permalinks and more. See the \"commands\" section of the README for more details.",
"version": "1.1.0",
"version": "1.1.1",
"publisher": "chdsbd",
"license": "SEE LICENSE IN LICENSE",
"icon": "images/logo256.png",
Expand Down
2 changes: 1 addition & 1 deletion src/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class Github extends BaseProvider {
DEFAULT_HOSTNAMES = ["github.com"]
PROVIDER_NAME = "github"
MATCHERS = [
(hostname: string) => RegExp(`^git@${hostname}:(.*)\/(.*)(\.git)?$`),
(hostname: string) => RegExp(`^[\\w-_]+@${hostname}:(.*)\/(.*)(\.git)?$`),
(hostname: string) => RegExp(`^https:\/\/${hostname}\/(.*)\/(.*)(\.git)?$`),
]
async getUrls({
Expand Down
2 changes: 2 additions & 0 deletions src/test/suite/providers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ suite("Github", async () => {
for (let url of [
"[email protected]:recipeyak/recipeyak.git",
"[email protected]:recipeyak/recipeyak",
"[email protected]:recipeyak/recipeyak"
]) {
async function findRemote(hostname: string) {
return url
Expand Down Expand Up @@ -69,6 +70,7 @@ suite("Github", async () => {
for (let url of [
"[email protected]:recipeyak/recipeyak.git",
"[email protected]:recipeyak/recipeyak",
"[email protected]:recipeyak/recipeyak"
]) {
async function findRemote(hostname: string) {
return url
Expand Down

0 comments on commit 3db1d07

Please sign in to comment.