api: client: build: do not fall through if git isn't installed

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: 167cc42986c8939c7aacf73570adaf19b8cad0b3
Component: engine
This commit is contained in:
Antonio Murdaca
2016-01-16 11:59:13 +01:00
parent 66b0f4bcad
commit dca237fb71
2 changed files with 19 additions and 4 deletions

View File

@ -6632,3 +6632,18 @@ func (s *DockerSuite) TestBuildCacheRootSource(c *check.C) {
c.Assert(out, checker.Not(checker.Contains), "Using cache")
}
// #19375
func (s *DockerSuite) TestBuildFailsGitNotCallable(c *check.C) {
cmd := exec.Command(dockerBinary, "build", "github.com/docker/v1.10-migrator.git")
cmd.Env = append(cmd.Env, "PATH=")
out, _, err := runCommandWithOutput(cmd)
c.Assert(err, checker.NotNil)
c.Assert(out, checker.Contains, "unable to prepare context: unable to find 'git': ")
cmd = exec.Command(dockerBinary, "build", "https://github.com/docker/v1.10-migrator.git")
cmd.Env = append(cmd.Env, "PATH=")
out, _, err = runCommandWithOutput(cmd)
c.Assert(err, checker.NotNil)
c.Assert(out, checker.Contains, "unable to prepare context: unable to find 'git': ")
}