From 55156848194cbd3c33583c36df360670e8307160 Mon Sep 17 00:00:00 2001 From: unclebill Date: Wed, 13 Mar 2024 11:22:37 +0800 Subject: [PATCH] remote could be set to local directory return empty string for remote that points to local directory --- src/model/buffer.ts | 1 + src/util.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/model/buffer.ts b/src/model/buffer.ts index 26c143e..a963e13 100644 --- a/src/model/buffer.ts +++ b/src/model/buffer.ts @@ -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 = "|" diff --git a/src/util.ts b/src/util.ts index 3a61ddb..77b2bd7 100644 --- a/src/util.ts +++ b/src/util.ts @@ -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)