Skip to content

Commit 135cca6

Browse files
author
Tibor Vass
committed
utils: move git functions to pkg/gitutils
Signed-off-by: Tibor Vass <[email protected]>
1 parent 5fd9a8f commit 135cca6

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

api/client/build.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"github.com/docker/docker/opts"
2121
"github.com/docker/docker/pkg/archive"
2222
"github.com/docker/docker/pkg/fileutils"
23+
"github.com/docker/docker/pkg/gitutils"
2324
"github.com/docker/docker/pkg/httputils"
2425
"github.com/docker/docker/pkg/jsonmessage"
2526
flag "github.com/docker/docker/pkg/mflag"
@@ -421,7 +422,7 @@ func getContextFromReader(r io.Reader, dockerfileName string) (absContextDir, re
421422
// path of the dockerfile in that context directory, and a non-nil error on
422423
// success.
423424
func getContextFromGitURL(gitURL, dockerfileName string) (absContextDir, relDockerfile string, err error) {
424-
if absContextDir, err = utils.GitClone(gitURL); err != nil {
425+
if absContextDir, err = gitutils.Clone(gitURL); err != nil {
425426
return "", "", fmt.Errorf("unable to 'git clone' to temporary context directory: %v", err)
426427
}
427428

builder/git.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import (
44
"os"
55

66
"github.com/docker/docker/pkg/archive"
7-
"github.com/docker/docker/utils"
7+
"github.com/docker/docker/pkg/gitutils"
88
)
99

1010
// MakeGitContext returns a Context from gitURL that is cloned in a temporary directory.
1111
func MakeGitContext(gitURL string) (ModifiableContext, error) {
12-
root, err := utils.GitClone(gitURL)
12+
root, err := gitutils.Clone(gitURL)
1313
if err != nil {
1414
return nil, err
1515
}

utils/git.go pkg/gitutils/gitutils.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package utils
1+
package gitutils
22

33
import (
44
"fmt"
@@ -14,9 +14,9 @@ import (
1414
"github.com/docker/docker/pkg/urlutil"
1515
)
1616

17-
// GitClone clones a repository into a newly created directory which
17+
// Clone clones a repository into a newly created directory which
1818
// will be under "docker-build-git"
19-
func GitClone(remoteURL string) (string, error) {
19+
func Clone(remoteURL string) (string, error) {
2020
if !urlutil.IsGitTransport(remoteURL) {
2121
remoteURL = "https://" + remoteURL
2222
}

utils/git_test.go pkg/gitutils/gitutils_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package utils
1+
package gitutils
22

33
import (
44
"fmt"

0 commit comments

Comments
 (0)