Commit de5288d6 authored by Tomasz Maczukin's avatar Tomasz Maczukin

Merge branch 'patch-2' into 'master'

Set GIT_SUBMODULE_STRATEGY=SubmoduleNone when GIT_STRATEGY=GitNone

Closes #2159

See merge request !480
parents 31646e53 5000affd
......@@ -412,6 +412,9 @@ func (b *Build) GetGitStrategy() GitStrategy {
}
func (b *Build) GetSubmoduleStrategy() SubmoduleStrategy {
if b.GetGitStrategy() == GitNone {
return SubmoduleNone
}
switch b.GetAllVariables().Get("GIT_SUBMODULE_STRATEGY") {
case "normal":
return SubmoduleNormal
......
......@@ -332,6 +332,27 @@ func TestBuildWithGitSubmoduleStrategyInvalid(t *testing.T) {
})
}
func TestBuildWithGitSubmoduleStrategyRecursiveAndGitStrategyNone(t *testing.T) {
onEachShell(t, func(t *testing.T, shell string) {
successfulBuild, err := common.GetSuccessfulBuild()
assert.NoError(t, err)
build, cleanup := newBuild(t, successfulBuild, shell)
defer cleanup()
build.Variables = append(build.Variables, common.BuildVariable{Key: "GIT_STRATEGY", Value: "none"})
build.Variables = append(build.Variables, common.BuildVariable{Key: "GIT_SUBMODULE_STRATEGY", Value: "recursive"})
out, err := runBuildReturningOutput(t, build)
assert.NoError(t, err)
assert.NotContains(t, out, "Cloning repository")
assert.NotContains(t, out, "Fetching changes")
assert.Contains(t, out, "Skipping Git repository setup")
assert.NotContains(t, out, "Updating/initializing submodules...")
assert.NotContains(t, out, "Updating/initializing submodules recursively...")
assert.Contains(t, out, "Skipping Git submodules setup")
})
}
func TestBuildWithDebugTrace(t *testing.T) {
onEachShell(t, func(t *testing.T, shell string) {
successfulBuild, err := common.GetSuccessfulBuild()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment