1
0
mirror of https://github.com/go-gitea/git.git synced 2026-02-05 15:45:40 +01:00

initial command

This commit is contained in:
Unknwon
2015-11-26 17:34:02 -05:00
commit 6c189876cb
5 changed files with 180 additions and 0 deletions

21
repo.go Normal file
View File

@@ -0,0 +1,21 @@
// Copyright 2015 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package git
import (
"os"
)
// InitRepository initializes a new Git repository in choice of bare or not.
func InitRepository(repoPath string, bare bool) error {
os.MkdirAll(repoPath, os.ModePerm)
cmd := NewCommand("init")
if bare {
cmd.AddArguments("--bare")
}
_, err := cmd.RunInDir(repoPath)
return err
}