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

remote could be set to local directory #212

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/model/buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ export default class GitBuffer implements Disposable {
let uri = await this.repo.safeRun(['config', '--get', `remote.${name}.url`])
if (!uri.length) continue
let repoURL = getRepoUrl(uri)
if (!repoURL) continue
let tmp = new URL(repoURL)
let hostname = tmp.hostname
let fix = "|"
Expand Down
4 changes: 3 additions & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ export function equals(one: any, other: any): boolean {
return true
}

export function getRepoUrl(remote: string): string {
export function getRepoUrl(remote: string): string | null {
// Remote is local directory
if (path.isAbsolute(remote)) return null
let url = remote.replace(/\s+$/, '').replace(/\.git$/, '')
if (url.startsWith('git@')) {
let str = url.slice(4)
Expand Down