Skip to content

Commit

Permalink
remote could be set to local directory
Browse files Browse the repository at this point in the history
return empty string for remote that points to local directory
  • Loading branch information
UncleBill committed Mar 13, 2024
1 parent cfc2b86 commit 5515684
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
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
2 changes: 2 additions & 0 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ export function equals(one: any, other: any): boolean {
}

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

0 comments on commit 5515684

Please sign in to comment.