Commit 1be04372 authored by Toon Claes's avatar Toon Claes

test: Non-existing component won't match git SHA

The #component_matches_git_sha? runs a git command to see if the
component is at the correct version. To run it, it uses
Gitlab::Popen, but as a side-effect it creates the directory before it
runs the command. This causes the rake task gitlab:gitaly:clone to
incorrectly determine if a git-clone(1) is needed.

To speed things up, and avoid creation of an empty directory, this
change adds an additional check to see if the component's folder exists
anyway.
parent 3f87fb22
......@@ -594,6 +594,8 @@ module TestEnv
# Not a git SHA, so return early
return false unless expected_version =~ ::Gitlab::Git::COMMIT_ID
return false unless Dir.exist?(component_folder)
sha, exit_status = Gitlab::Popen.popen(%W(#{Gitlab.config.git.bin_path} rev-parse HEAD), component_folder)
return false if exit_status != 0
......
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