1
0

Enable README creation and proper initial commit in auto-git

This commit is contained in:
2025-06-01 05:55:34 +02:00
parent 9afbe177d7
commit 6c456e2da2

10
main.js
View File

@@ -220,16 +220,16 @@ function watchRepo(folder, win) {
* Initiiert ein Git-Repo in `folder`, falls noch nicht vorhanden,
* und erzeugt einen Initial-Commit mit Timestamp.
*/
async function initGitRepo(folder) {
async function initGitRepo(folder) {
const git = simpleGit(folder);
const gitDir = path.join(folder, '.git');
if (!fs.existsSync(gitDir)) {
await git.init();
const message = `Initial commit (generated by auto-git)`;
//const readmePath = path.join(folder, 'README.md');
//fs.writeFileSync(readmePath, `# Projekt in ${path.basename(folder)}\n`);
//await git.add('./*');
//await git.commit(message);
const readmePath = path.join(folder, 'README.md');
fs.writeFileSync(readmePath, `# Projekt in ${path.basename(folder)}\n`); //this is shit, it just writes something to prevent bugs when dealing with an empty folder, can be solved way better
await git.add('./*');
await git.commit(message);
}
}