GIT_STRATEGY: fetch fails to clean submodules

Summary

GIT_STRATEGY: fetch is meant to save time by restoring an existing workspace to a pristine state instead of cloning it from scratch. To do so, it must reset (to restore tracked files) and clean (to remove untracked/ignored files) both the superproject and any existing submodules. Currently, it does both for the superproject. reset was added for submodules in 3cfb209c, but clean is still missing.

Steps to reproduce

Create a repository with a submodule. Using GIT_STRATEGY: fetch, run a pipeline that adds untracked/ignored files to the submodule. Run the pipeline again in the same workspace. You can ensure it occurs in the same workspace by using a shell executor, assigning only one runner to the project, disabling shared runners for the project, and specifying concurrent = 1 in your config.toml. Observe that the submodule's untracked/ignored files are not removed prior to the execution of any jobs.

Actual behavior

Submodules are not cleaned.

Expected behavior

Submodules should be cleaned.

Environment description

We are using a custom installation with the shell executor.

Used GitLab Runner version

Version:      10.1.0
Git revision: c1ecf97f
Git branch:   10-1-stable
GO version:   go1.8.3
Built:        Sat, 21 Oct 2017 21:33:24 +0000
OS/Arch:      linux/amd64

While we are using 10.1.0, I have verified that master lacks the necessary code as well.

Assignee Loading
Time tracking Loading