mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
When cloning by Nostr URI, set the URI in the remote
This commit is contained in:
2 files changed
+151
No files matched your search
@@ -646,6 +646,13 @@ export class Git {
|
||||
)
|
||||
]);
|
||||
|
||||
// After successful clone, update the origin remote to point to the Nostr URI
|
||||
await this.setRemoteURL({
|
||||
dir: originalOptions.dir,
|
||||
remote: 'origin',
|
||||
url: originalOptions.url,
|
||||
});
|
||||
|
||||
return; // Success!
|
||||
} catch (error) {
|
||||
console.warn(`Failed to clone from ${cloneUrl}:`, error);
|
||||
@@ -657,4 +664,21 @@ export class Git {
|
||||
// If we get here, all clone attempts failed
|
||||
throw lastError || new Error('All clone attempts failed');
|
||||
}
|
||||
|
||||
async setRemoteURL(options: { dir: string; remote: string; url: string }): Promise<void> {
|
||||
// Remove the existing remote
|
||||
await git.deleteRemote({
|
||||
fs: this.fs,
|
||||
dir: options.dir,
|
||||
remote: options.remote,
|
||||
});
|
||||
|
||||
// Add the remote with the new URL
|
||||
await git.addRemote({
|
||||
fs: this.fs,
|
||||
dir: options.dir,
|
||||
remote: options.remote,
|
||||
url: options.url,
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user