feat: implement default Git identity management and local identity check

This commit is contained in:
Bohdan Triapitsyn
2026-01-14 22:34:17 +02:00
parent e0cc212823
commit e0279e59b0
18 changed files with 310 additions and 25 deletions
+12
View File
@@ -160,6 +160,18 @@ export async function getCurrentIdentity(directory) {
}
}
export async function hasLocalIdentity(directory) {
const git = simpleGit(normalizeDirectoryPath(directory));
try {
const localName = await git.getConfig('user.name', 'local').catch(() => null);
const localEmail = await git.getConfig('user.email', 'local').catch(() => null);
return Boolean(localName?.value || localEmail?.value);
} catch {
return false;
}
}
export async function setLocalIdentity(directory, profile) {
const git = simpleGit(normalizeDirectoryPath(directory));