mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-03-09 21:50:36 +00:00
update fixes
This commit is contained in:
parent
f50ebc6ea7
commit
c200e2f74d
File diff suppressed because it is too large
Load Diff
@ -48,11 +48,23 @@ export const action: ActionFunction = async ({ request }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// Initial check stage
|
||||||
|
sendProgress({
|
||||||
|
stage: 'fetch',
|
||||||
|
message: 'Checking repository status...',
|
||||||
|
progress: 0,
|
||||||
|
});
|
||||||
|
|
||||||
// Check if remote exists
|
// Check if remote exists
|
||||||
let defaultBranch = branch || 'main'; // Make branch mutable
|
let defaultBranch = branch || 'main'; // Make branch mutable
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await execAsync('git remote get-url origin');
|
await execAsync('git remote get-url origin');
|
||||||
|
sendProgress({
|
||||||
|
stage: 'fetch',
|
||||||
|
message: 'Repository remote verified',
|
||||||
|
progress: 10,
|
||||||
|
});
|
||||||
} catch {
|
} catch {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'No remote repository found. Please set up the remote repository first by running:\ngit remote add origin https://github.com/stackblitz-labs/bolt.diy.git',
|
'No remote repository found. Please set up the remote repository first by running:\ngit remote add origin https://github.com/stackblitz-labs/bolt.diy.git',
|
||||||
@ -61,11 +73,27 @@ export const action: ActionFunction = async ({ request }) => {
|
|||||||
|
|
||||||
// Get default branch if not specified
|
// Get default branch if not specified
|
||||||
if (!branch) {
|
if (!branch) {
|
||||||
|
sendProgress({
|
||||||
|
stage: 'fetch',
|
||||||
|
message: 'Detecting default branch...',
|
||||||
|
progress: 20,
|
||||||
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { stdout } = await execAsync('git remote show origin | grep "HEAD branch" | cut -d" " -f5');
|
const { stdout } = await execAsync('git remote show origin | grep "HEAD branch" | cut -d" " -f5');
|
||||||
defaultBranch = stdout.trim() || 'main';
|
defaultBranch = stdout.trim() || 'main';
|
||||||
|
sendProgress({
|
||||||
|
stage: 'fetch',
|
||||||
|
message: `Using branch: ${defaultBranch}`,
|
||||||
|
progress: 30,
|
||||||
|
});
|
||||||
} catch {
|
} catch {
|
||||||
defaultBranch = 'main'; // Fallback to main if we can't detect
|
defaultBranch = 'main'; // Fallback to main if we can't detect
|
||||||
|
sendProgress({
|
||||||
|
stage: 'fetch',
|
||||||
|
message: 'Using default branch: main',
|
||||||
|
progress: 30,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,20 +101,36 @@ export const action: ActionFunction = async ({ request }) => {
|
|||||||
sendProgress({
|
sendProgress({
|
||||||
stage: 'fetch',
|
stage: 'fetch',
|
||||||
message: 'Fetching latest changes...',
|
message: 'Fetching latest changes...',
|
||||||
progress: 0,
|
progress: 40,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Fetch all remotes
|
// Fetch all remotes
|
||||||
await execAsync('git fetch --all');
|
await execAsync('git fetch --all');
|
||||||
|
sendProgress({
|
||||||
|
stage: 'fetch',
|
||||||
|
message: 'Remote changes fetched',
|
||||||
|
progress: 50,
|
||||||
|
});
|
||||||
|
|
||||||
// Check if remote branch exists
|
// Check if remote branch exists
|
||||||
try {
|
try {
|
||||||
await execAsync(`git rev-parse --verify origin/${defaultBranch}`);
|
await execAsync(`git rev-parse --verify origin/${defaultBranch}`);
|
||||||
|
sendProgress({
|
||||||
|
stage: 'fetch',
|
||||||
|
message: 'Remote branch verified',
|
||||||
|
progress: 60,
|
||||||
|
});
|
||||||
} catch {
|
} catch {
|
||||||
throw new Error(`Remote branch 'origin/${defaultBranch}' not found. Please push your changes first.`);
|
throw new Error(`Remote branch 'origin/${defaultBranch}' not found. Please push your changes first.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get current commit hash and remote commit hash
|
// Get current commit hash and remote commit hash
|
||||||
|
sendProgress({
|
||||||
|
stage: 'fetch',
|
||||||
|
message: 'Comparing versions...',
|
||||||
|
progress: 70,
|
||||||
|
});
|
||||||
|
|
||||||
const { stdout: currentCommit } = await execAsync('git rev-parse HEAD');
|
const { stdout: currentCommit } = await execAsync('git rev-parse HEAD');
|
||||||
const { stdout: remoteCommit } = await execAsync(`git rev-parse origin/${defaultBranch}`);
|
const { stdout: remoteCommit } = await execAsync(`git rev-parse origin/${defaultBranch}`);
|
||||||
|
|
||||||
@ -96,10 +140,20 @@ export const action: ActionFunction = async ({ request }) => {
|
|||||||
stage: 'complete',
|
stage: 'complete',
|
||||||
message: 'No updates available. You are on the latest version.',
|
message: 'No updates available. You are on the latest version.',
|
||||||
progress: 100,
|
progress: 100,
|
||||||
|
details: {
|
||||||
|
currentCommit: currentCommit.trim().substring(0, 7),
|
||||||
|
remoteCommit: remoteCommit.trim().substring(0, 7),
|
||||||
|
},
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sendProgress({
|
||||||
|
stage: 'fetch',
|
||||||
|
message: 'Analyzing changes...',
|
||||||
|
progress: 80,
|
||||||
|
});
|
||||||
|
|
||||||
// Initialize variables
|
// Initialize variables
|
||||||
let changedFiles: string[] = [];
|
let changedFiles: string[] = [];
|
||||||
let commitMessages: string[] = [];
|
let commitMessages: string[] = [];
|
||||||
@ -131,10 +185,20 @@ export const action: ActionFunction = async ({ request }) => {
|
|||||||
stage: 'complete',
|
stage: 'complete',
|
||||||
message: `No file changes detected between your version and origin/${defaultBranch}. You might be on a different branch.`,
|
message: `No file changes detected between your version and origin/${defaultBranch}. You might be on a different branch.`,
|
||||||
progress: 100,
|
progress: 100,
|
||||||
|
details: {
|
||||||
|
currentCommit: currentCommit.trim().substring(0, 7),
|
||||||
|
remoteCommit: remoteCommit.trim().substring(0, 7),
|
||||||
|
},
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sendProgress({
|
||||||
|
stage: 'fetch',
|
||||||
|
message: `Found ${files.length} changed files, calculating sizes...`,
|
||||||
|
progress: 90,
|
||||||
|
});
|
||||||
|
|
||||||
// Get size information for each changed file
|
// Get size information for each changed file
|
||||||
for (const line of files) {
|
for (const line of files) {
|
||||||
const [status, file] = line.split('\t');
|
const [status, file] = line.split('\t');
|
||||||
|
Loading…
Reference in New Issue
Block a user