auto-git:
[change] main.js
This commit is contained in:
7
main.js
7
main.js
@@ -264,18 +264,13 @@ function watchRepo(folder, win) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Initiiert ein Git-Repo in `folder`, falls noch nicht vorhanden,
|
* Initiiert ein Git-Repo in `folder`, falls noch nicht vorhanden,
|
||||||
* und erzeugt einen Initial-Commit mit Timestamp.
|
* ohne Dateien oder Commits anzulegen.
|
||||||
*/
|
*/
|
||||||
async function initGitRepo(folder) {
|
async function initGitRepo(folder) {
|
||||||
const git = simpleGit(folder);
|
const git = simpleGit(folder);
|
||||||
const gitDir = path.join(folder, '.git');
|
const gitDir = path.join(folder, '.git');
|
||||||
if (!fs.existsSync(gitDir)) {
|
if (!fs.existsSync(gitDir)) {
|
||||||
await git.init();
|
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user