@@ -26,8 +26,17 @@ func gitError(err *exec.ExitError, cmd []string) error {
2626// CreateRemote adds a git remote in the current directory.
2727func CreateRemote (host , remote , appID string ) error {
2828 cmd := []string {"git" , "remote" , "add" , remote , RemoteURL (host , appID )}
29- _ , err := exec .Command (cmd [0 ], cmd [1 :]... ).Output ()
30- if err != nil {
29+ if _ , err := exec .Command (cmd [0 ], cmd [1 :]... ).Output (); err != nil {
30+ return gitError (err .(* exec.ExitError ), cmd )
31+ }
32+
33+ return nil
34+ }
35+
36+ // Init creates a new git repository in the local directory.
37+ func Init () error {
38+ cmd := []string {"git" , "init" }
39+ if _ , err := exec .Command (cmd [0 ], cmd [1 :]... ).Output (); err != nil {
3140 return gitError (err .(* exec.ExitError ), cmd )
3241 }
3342
@@ -54,8 +63,7 @@ func DeleteAppRemotes(host, appID string) error {
5463// DeleteRemote removes a remote from the repository
5564func DeleteRemote (name string ) error {
5665 cmd := []string {"git" , "remote" , "remove" , name }
57- _ , err := exec .Command (cmd [0 ], cmd [1 :]... ).Output ()
58- if err != nil {
66+ if _ , err := exec .Command (cmd [0 ], cmd [1 :]... ).Output (); err != nil {
5967 return gitError (err .(* exec.ExitError ), cmd )
6068 }
6169
0 commit comments