Commit c1ec30ab authored by Steve Azzopardi's avatar Steve Azzopardi

Move git cleanup after changing directory

When using the shell executor there might be some untracked flies that
are created from previous builds, which might cause the build to fail,
we should do a clean up every time no matter the if we clone or fetch.
parent d8a7e4b6
......@@ -154,6 +154,7 @@ func (b *AbstractShell) writeRefspecFetchCmd(w ShellWriter, build *common.Build,
w.Command("git", "init", projectDir, "--template", templateDir)
w.Cd(projectDir)
b.writeGitCleanup(w)
// fetching
if depth > 0 {
......@@ -167,7 +168,6 @@ func (b *AbstractShell) writeRefspecFetchCmd(w ShellWriter, build *common.Build,
w.Notice("Created fresh repository.")
w.Else()
w.Command("git", "remote", "set-url", "origin", build.GetRemoteURL())
b.writeGitCleanup(w)
w.EndIf()
fetchArgs := []string{"fetch", "origin", "--prune"}
......
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