mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
utils: move git functions to pkg/gitutils
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
parent
5fd9a8f603
commit
135cca6f52
4 changed files with 8 additions and 7 deletions
|
@ -20,6 +20,7 @@ import (
|
|||
"github.com/docker/docker/opts"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/pkg/fileutils"
|
||||
"github.com/docker/docker/pkg/gitutils"
|
||||
"github.com/docker/docker/pkg/httputils"
|
||||
"github.com/docker/docker/pkg/jsonmessage"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
|
@ -421,7 +422,7 @@ func getContextFromReader(r io.Reader, dockerfileName string) (absContextDir, re
|
|||
// path of the dockerfile in that context directory, and a non-nil error on
|
||||
// success.
|
||||
func getContextFromGitURL(gitURL, dockerfileName string) (absContextDir, relDockerfile string, err error) {
|
||||
if absContextDir, err = utils.GitClone(gitURL); err != nil {
|
||||
if absContextDir, err = gitutils.Clone(gitURL); err != nil {
|
||||
return "", "", fmt.Errorf("unable to 'git clone' to temporary context directory: %v", err)
|
||||
}
|
||||
|
||||
|
|
|
@ -4,12 +4,12 @@ import (
|
|||
"os"
|
||||
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/utils"
|
||||
"github.com/docker/docker/pkg/gitutils"
|
||||
)
|
||||
|
||||
// MakeGitContext returns a Context from gitURL that is cloned in a temporary directory.
|
||||
func MakeGitContext(gitURL string) (ModifiableContext, error) {
|
||||
root, err := utils.GitClone(gitURL)
|
||||
root, err := gitutils.Clone(gitURL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package utils
|
||||
package gitutils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
@ -14,9 +14,9 @@ import (
|
|||
"github.com/docker/docker/pkg/urlutil"
|
||||
)
|
||||
|
||||
// GitClone clones a repository into a newly created directory which
|
||||
// Clone clones a repository into a newly created directory which
|
||||
// will be under "docker-build-git"
|
||||
func GitClone(remoteURL string) (string, error) {
|
||||
func Clone(remoteURL string) (string, error) {
|
||||
if !urlutil.IsGitTransport(remoteURL) {
|
||||
remoteURL = "https://" + remoteURL
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package utils
|
||||
package gitutils
|
||||
|
||||
import (
|
||||
"fmt"
|
Loading…
Add table
Reference in a new issue