Remove unnecessary remote add (other place)

This commit is contained in:
Alex Gleason committed 2025-12-22 14:01:46 -06:00
1 parent 95dead2c79
commit 8eeea7b188
1 file changed
+9 -39
+9 -39
View File
@@ -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');