Fix gitlab shell test preparation reset method #8128
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bug introduced by self at: #7823
Before this PR, the test gitlab shell under
tmp/tests/gitlab-shell
will not correctly fetch new commits if necessary when it exists already (the cache was introduced on the PR that causes this problem: before it would always get removed and cloned).This happens because the
shell.rake
sh reset
line I wrote was completely wrong because:git reset --hard
: if there is no reference,reset --hard $()
will do justgit reset --hard
, which is valid, and does not activate the||
true || echo a && echo b
translates to(true || echo a) && echo b
, so thefetch
part was never done!Now it works, but is a monster expression. We could split this up into multiple system calls, but that would break the current convention of using
sh
.This was extracted from: #8086