mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 08:37:22 +00:00
Remove unnecessary remote add (other place)
This commit is contained in:
1 file changed
+9
-39
+9
-39
@@ -2047,50 +2047,20 @@ export class Git {
|
|||||||
try {
|
try {
|
||||||
console.log(`Fetching from Git remote: ${httpsCloneUrl}`);
|
console.log(`Fetching from Git remote: ${httpsCloneUrl}`);
|
||||||
|
|
||||||
// Add a temporary remote
|
// Fetch from the temporary remote
|
||||||
const tempRemoteName = `temp-${Date.now()}`;
|
const fetchResult = await git.fetch({
|
||||||
await git.addRemote({
|
|
||||||
fs: this.fs,
|
fs: this.fs,
|
||||||
|
http: this.http,
|
||||||
dir,
|
dir,
|
||||||
remote: tempRemoteName,
|
tags: true,
|
||||||
url: httpsCloneUrl,
|
url: httpsCloneUrl,
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
return {
|
||||||
// Fetch from the temporary remote
|
fetchHead: fetchResult.fetchHead || null,
|
||||||
const fetchResult = await git.fetch({
|
fetchHeadDescription: `Fetched from Git remote: ${httpsCloneUrl}`,
|
||||||
fs: this.fs,
|
defaultBranch: fetchResult.defaultBranch || null,
|
||||||
http: this.http,
|
};
|
||||||
dir,
|
|
||||||
tags: true,
|
|
||||||
remote: tempRemoteName,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Remove the temporary remote
|
|
||||||
await git.deleteRemote({
|
|
||||||
fs: this.fs,
|
|
||||||
dir,
|
|
||||||
remote: tempRemoteName,
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
|
||||||
fetchHead: fetchResult.fetchHead || null,
|
|
||||||
fetchHeadDescription: `Fetched from Git remote: ${httpsCloneUrl}`,
|
|
||||||
defaultBranch: fetchResult.defaultBranch || null,
|
|
||||||
};
|
|
||||||
} catch (fetchError) {
|
|
||||||
// Clean up the temporary remote
|
|
||||||
try {
|
|
||||||
await git.deleteRemote({
|
|
||||||
fs: this.fs,
|
|
||||||
dir,
|
|
||||||
remote: tempRemoteName,
|
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
// Ignore cleanup errors
|
|
||||||
}
|
|
||||||
throw fetchError;
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn(`Failed to fetch from ${httpsCloneUrl}:`, error);
|
console.warn(`Failed to fetch from ${httpsCloneUrl}:`, error);
|
||||||
throw error instanceof Error ? error : new Error('Unknown error');
|
throw error instanceof Error ? error : new Error('Unknown error');
|
||||||
|
|||||||
Reference in new issue
Block a user