Merge pull request #12502 from calavera/shallow_git_history

Shallow clone using git to build images.
This commit is contained in:
Alexander Morozov
2015-04-24 10:16:01 -07:00
5 changed files with 113 additions and 25 deletions
+1 -10
View File
@@ -96,20 +96,11 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
} else {
root := cmd.Arg(0)
if urlutil.IsGitURL(root) {
remoteURL := cmd.Arg(0)
if !urlutil.IsGitTransport(remoteURL) {
remoteURL = "https://" + remoteURL
}
root, err = ioutil.TempDir("", "docker-build-git")
root, err = utils.GitClone(root)
if err != nil {
return err
}
defer os.RemoveAll(root)
if output, err := exec.Command("git", "clone", "--recursive", remoteURL, root).CombinedOutput(); err != nil {
return fmt.Errorf("Error trying to use git: %s (%s)", err, output)
}
}
if _, err := os.Stat(root); err != nil {
return err