Skip to content

Commit

Permalink
fix: create new remote
Browse files Browse the repository at this point in the history
close #599
  • Loading branch information
Vinzent03 committed Jan 8, 2024
1 parent d9e8be1 commit 1a4cca8
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/gitManager/simpleGit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,11 +522,16 @@ export class SimpleGit extends GitManager {
}

async getRemoteUrl(remote: string): Promise<string | undefined> {
return (
(await this.git.remote(["get-url", remote], (err, url) =>
this.onError(err)
)) || undefined
);
try {
await this.git.remote(["get-url", remote]);
} catch (error) {
// Verify the error is at least not about git is not found or similar. Checks if the remote exists or not
if (error.toString().contains(remote)) {
return undefined;
} else {
this.onError(error);
}
}
}

// https://github.com/kometenstaub/obsidian-version-history-diff/issues/3
Expand Down

0 comments on commit 1a4cca8

Please sign in to comment.