1
0

Ensure initial commit is created during Git repo initialization

This commit is contained in:
Victor Giers
2025-11-27 11:39:37 +01:00
parent f2037299e2
commit 9bf17a7eac

View File

@@ -271,13 +271,14 @@ function watchRepo(folder, win) {
/**
* Initiiert ein Git-Repo in `folder`, falls noch nicht vorhanden,
* ohne Dateien oder Commits anzulegen.
* erzeugt bei Bedarf einen leeren Initial-Commit.
*/
async function initGitRepo(folder) {
const git = simpleGit(folder);
const gitDir = path.join(folder, '.git');
if (!fs.existsSync(gitDir)) {
await git.init();
await git.commit('initial commit', undefined, { '--allow-empty': null });
}
}