Dieser Commit ist enthalten in:
Claude Project Manager
2025-12-28 22:00:19 +00:00
Ursprung ab1e5be9a9
Commit 8da6ad83f0
12 geänderte Dateien mit 197 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -448,14 +448,8 @@ function pushWithUpstream(localPath, branch = null, remoteName = 'origin') {
return { success: false, error: 'Kein Git-Repository' };
}
// Aktuellen Branch ermitteln falls nicht angegeben
if (!branch) {
const branchResult = execGitCommand('git branch --show-current', localPath);
branch = branchResult.success && branchResult.output ? branchResult.output : 'main';
}
// Prüfe ob Commits existieren
const logResult = execGitCommand('git rev-parse HEAD', localPath);
let logResult = execGitCommand('git rev-parse HEAD', localPath);
if (!logResult.success) {
// Keine Commits - erstelle einen initialen Commit
const statusResult = execGitCommand('git status --porcelain', localPath);
@ -472,13 +466,55 @@ function pushWithUpstream(localPath, branch = null, remoteName = 'origin') {
}
logger.info('Initialer Commit erstellt vor Push');
// Verifiziere dass der Commit erstellt wurde
logResult = execGitCommand('git rev-parse HEAD', localPath);
if (!logResult.success) {
return { success: false, error: 'Commit wurde erstellt aber HEAD existiert nicht' };
}
} else {
return { success: false, error: 'Keine Commits und keine Dateien zum Committen vorhanden' };
}
}
// Aktuellen Branch ermitteln NACH dem Commit
const branchResult = execGitCommand('git branch --show-current', localPath);
if (branchResult.success && branchResult.output) {
branch = branchResult.output;
logger.info(`Aktueller Branch: ${branch}`);
} else {
// Fallback: Branch aus git branch auslesen
const branchListResult = execGitCommand('git branch', localPath);
logger.info(`Branch-Liste: ${branchListResult.output}`);
if (branchListResult.success && branchListResult.output) {
const lines = branchListResult.output.split('\n');
for (const line of lines) {
if (line.includes('*')) {
branch = line.replace('*', '').trim();
break;
}
}
}
if (!branch) {
// Letzter Fallback: Versuche den Branch zu erstellen
logger.info('Kein Branch gefunden, erstelle main');
execGitCommand('git checkout -b main', localPath);
branch = 'main';
}
}
logger.info(`Push auf Branch: ${branch}`);
// Push mit -u für Upstream-Tracking
return execGitCommand(`git push -u ${remoteName} ${branch}`, localPath, { timeout: 120000 });
const pushResult = execGitCommand(`git push -u ${remoteName} ${branch}`, localPath, { timeout: 120000 });
if (!pushResult.success) {
logger.error(`Push fehlgeschlagen: ${pushResult.error}`);
}
return pushResult;
}
/**