Änderung Autor
Dieser Commit ist enthalten in:
committet von
Claude Project Manager
Ursprung
627beb1353
Commit
dad07c7879
@ -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);
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren