Skip to content

Commit 0c9bb86

Browse files
committed
Add some better error messages.
1 parent 32d8a59 commit 0c9bb86

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

remote.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import (
1414
"path/filepath"
1515
"strings"
1616

17-
"gopkg.in/gcfg.v1"
1817
"golang.org/x/crypto/ssh"
18+
"gopkg.in/gcfg.v1"
1919
)
2020

2121
// Formatted script that checks if the build happened.
@@ -111,22 +111,22 @@ func (r *Remote) Push() error {
111111
}
112112
if key, err := NewKeyFile(r.sshConfig.Identity); err == nil {
113113
cmd := exec.Command("ssh-add", key)
114-
if _, err = cmd.CombinedOutput(); err != nil {
115-
return err
114+
if output, err := cmd.CombinedOutput(); err != nil {
115+
return fmt.Errorf("%s\n%s", string(output), err)
116116
}
117117
}
118118
cmd := exec.Command("git", "rev-parse", "--abbrev-ref", "HEAD")
119119
cmd.Dir = r.Git.Work
120120
b, err := cmd.CombinedOutput()
121121
if err != nil {
122-
return err
122+
return fmt.Errorf("HEAD does not exist. Did you make a commit?")
123123
}
124124
branch := strings.TrimSpace(string(b))
125125
if branch == "HEAD" {
126126
branch = fmt.Sprintf("%s:refs/heads/happened", branch)
127127
}
128128
if err := r.Initialize(); err != nil {
129-
return fmt.Errorf("%s\n%s", err)
129+
return fmt.Errorf("%s\n", err)
130130
}
131131
if output, err := r.Git.Push(branch); err != nil {
132132
return fmt.Errorf("%s\n%s", string(output), err)
@@ -148,8 +148,8 @@ func (r *Remote) PushSubmodules() error {
148148
}
149149
cmd := exec.Command("git", "submodule", "update", "--init")
150150
cmd.Dir = r.Git.Work
151-
if _, err := cmd.CombinedOutput(); err != nil {
152-
return err
151+
if output, err := cmd.CombinedOutput(); err != nil {
152+
return fmt.Errorf("%s\n%s", string(output), err)
153153
}
154154
errors := []string{}
155155
for _, module := range modules.Submodules {

0 commit comments

Comments
 (0)