big fixes

fixes feedback from thecodacus
This commit is contained in:
Stijnus
2025-01-30 17:17:36 +01:00
parent d9a380f28a
commit d1d23d80e7
68 changed files with 2449 additions and 1350 deletions

View File

@@ -9,22 +9,30 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
try {
// Get git information using git commands
const branch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
const commit = execSync('git rev-parse HEAD').toString().trim();
const commitHash = execSync('git rev-parse HEAD').toString().trim();
const commitTime = execSync('git log -1 --format=%cd').toString().trim();
const author = execSync('git log -1 --format=%an').toString().trim();
const email = execSync('git log -1 --format=%ae').toString().trim();
const remoteUrl = execSync('git config --get remote.origin.url').toString().trim();
// Extract repo name from remote URL
const repoName = remoteUrl.split('/').pop()?.replace('.git', '') || '';
const gitInfo = {
branch,
commit,
commitTime,
author,
remoteUrl,
local: {
commitHash,
branch,
commitTime,
author,
email,
remoteUrl,
repoName,
},
};
res.status(200).json(gitInfo);
return res.status(200).json(gitInfo);
} catch (error) {
console.error('Failed to get git information:', error);
res.status(500).json({ message: 'Failed to get git information' });
return res.status(500).json({ message: 'Failed to get git information' });
}
}