FilipChalupa / FitGit

https://github.com/Onset/git-latex-document
MIT License
1 stars 1 forks source link

Libgit2 padl #56

Closed FilipChalupa closed 7 years ago

FilipChalupa commented 7 years ago

image

.then(() => {
    return nodegit.Repository.init(path, 0)
        .then((r) => repo = r)
        .then(() => nodegit.Remote.create(repo, 'origin', trimmedUrl))
        //.then(() => exec(`cd ${path} && git push --set-upstream origin master`))
        .then(() => repo.refreshIndex())
        .then((index) => index.writeTree())
        .then((oid) => {
            const author = repo.defaultSignature()
            return repo.createCommit('HEAD', author, author, 'Init', oid, [])
        })
        //.then(() => repo.getHeadCommit())
        //.then((c) => console.log(c))
        .then((headCommit) => nodegit.Branch.create(repo, 'master', headCommit, 1))
        .then((currentBranch) => nodegit.Branch.setUpstream(currentBranch, 'origin'))
        .catch((error) => {
            console.warn(error)
            errorMessage = 'Projekt se nepodařilo vytvořit'
            throw new Error('Unable to init repository.')
        })
})