devel-importer: use common.GitExec()
This commit is contained in:
@@ -98,7 +98,7 @@ func (e *GitHandler) GitBranchHead(gitDir, branchName string) (string, error) {
|
||||
return "", fmt.Errorf("Can't find default remote branch: %s", branchName)
|
||||
}
|
||||
|
||||
return strings.TrimSpace(id), nil
|
||||
return strings.TrimSpace(id), nil
|
||||
}
|
||||
|
||||
func (e *GitHandler) Close() error {
|
||||
@@ -125,6 +125,20 @@ func (h writeFunc) Close() error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (e *GitHandler) GitExecWithOutputOrPanic(cwd string, params ...string) string {
|
||||
out, err := e.GitExecWithOutput(cwd, params...)
|
||||
if err != nil {
|
||||
log.Panicln("git command failed:", params, "err:", err)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func (e *GitHandler) GitExecOrPanic(cwd string, params ...string) {
|
||||
if err := e.GitExec(cwd, params...); err != nil {
|
||||
log.Panicln("git command failed:", params, "err:", err)
|
||||
}
|
||||
}
|
||||
|
||||
func (e *GitHandler) GitExec(cwd string, params ...string) error {
|
||||
_, err := e.GitExecWithOutput(cwd, params...)
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user