Änderung Autor

Dieser Commit ist enthalten in:
HG
2025-12-29 19:20:26 +00:00
committet von Claude Project Manager
Ursprung 627beb1353
Commit dad07c7879
11 geänderte Dateien mit 269 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -175,8 +175,14 @@ router.post('/commit/:projectId', (req, res) => {
}
}
// Commit erstellen
const result = gitService.commit(application.local_path, message);
// Autor aus eingeloggtem Benutzer
const author = req.user ? {
name: req.user.display_name || req.user.username,
email: req.user.email || `${req.user.username.toLowerCase()}@taskmate.local`
} : null;
// Commit erstellen mit Autor
const result = gitService.commit(application.local_path, message, author);
res.json(result);
} catch (error) {
logger.error('Fehler beim Commit:', error);

Datei anzeigen

@ -253,8 +253,11 @@ function stageAll(localPath) {
/**
* Commit erstellen
* @param {string} localPath - Pfad zum Repository
* @param {string} message - Commit-Nachricht
* @param {object} author - Autor-Informationen { name, email }
*/
function commit(localPath, message) {
function commit(localPath, message, author = null) {
if (!isGitRepository(localPath)) {
return { success: false, error: 'Kein Git-Repository' };
}
@ -265,7 +268,17 @@ function commit(localPath, message) {
// Escape für Shell
const escapedMessage = message.replace(/"/g, '\\"');
return execGitCommand(`git commit -m "${escapedMessage}"`, localPath);
// Commit-Befehl mit optionalem Autor
let commitCmd = `git commit -m "${escapedMessage}"`;
if (author && author.name) {
const authorName = author.name.replace(/"/g, '\\"');
const authorEmail = author.email || `${author.name.toLowerCase().replace(/\s+/g, '.')}@taskmate.local`;
commitCmd = `git commit --author="${authorName} <${authorEmail}>" -m "${escapedMessage}"`;
logger.info(`Commit mit Autor: ${authorName} <${authorEmail}>`);
}
return execGitCommand(commitCmd, localPath);
}
/**