-
Notifications
You must be signed in to change notification settings - Fork 697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not use shallow clones for short revisions #10639
base: master
Are you sure you want to change the base?
Conversation
8ee89f0
to
9669788
Compare
9669788
to
3e0a447
Compare
(Just noting that it's quite unfortunate how the versions of the formatter are out of sync between my computer and CI) |
Fixes #10605 |
-- full hashes are 40 characters | ||
| Just tg <- srpTag | ||
, length tg >= 40 = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be exactly 40 characters and all hexadecimal characters; e.g. 48c42600594a381af18afb24d8eb857396876f0ff
is not valid and 48c42600594a38Iaf18afb24d8eb857396876f0f
is not valid.
-- Then, reset to the appropriate ref. | ||
git localDir $ | ||
"reset" | ||
: verboseArg | ||
++ [ "--hard" | ||
, ref | ||
, "--" | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that git reset --hard HEAD
is needed to check out the sources when git clone --no-checkout
is used, i.e. even if the clone is not shallow.
EDIT: I suspect this is why the tests are failing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can do something like Just ref | doShallow -> ...
to guard that case and then put the Nothing ->
branch at the bottom. (That would also avoid reindenting the whole block, not that it matters very much.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right! Indeed, we must still reset when the clone uses --no-checkout. I've fixed this now. Thanks
I wonder if we should issue a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, the test suite is not able to test shallow clones at all -- let's make sure we get those tested before we merge this.
If you run the tests right now, you'll see that the --depth
flag is ignored:
$ ./validate.sh -s build -s cli-tests -p VCS
$ /Users/wiggles/cabal/master/dist-newstyle-validate-ghc-9.8.2/build/aarch64-osx/ghc-9.8.2/cabal-install-3.15.0.0/t/long-tests/build/long-tests/long-tests --num-threads 20 --pattern VCS
File modification time resolution calibration completed, maximum delay
observed: 1.778 ms. Will be using delay of 20.0 for test runs.
Long-running tests
UnitTests.Distribution.Client.VCS
git
check VCS test framework: warning: --depth is ignored in local clones; use file:// instead.
warning: --depth is ignored in local clones; use file:// instead.
warning: --depth is ignored in local clones; use file:// instead.
warning: --depth is ignored in local clones; use file:// instead.
check VCS test framework: 20% warning: --depth is ignored in local clones; use file:// instead.
warning: --depth is ignored in local clones; use file:// instead.
warning: --depth is ignored in local clones; use file:// instead.
warning: --depth is ignored in local clones; use file:// instead.
warning: --depth is ignored in local clones; use file:// instead.
warning: --depth is ignored in local clones; use file:// instead.
check VCS test framework: 30% warning: --depth is ignored in local clones; use file:// instead.
check VCS test framework: OK (33.93s)
+++ OK, passed 10 tests.
cloneSourceRepo: 60% warning: --depth is ignored in local clones; use file:// instead.
cloneSourceRepo: 80% warning: --depth is ignored in local clones; use file:// instead.
warning: --depth is ignored in local clones; use file:// instead.
warning: --depth is ignored in local clones; use file:// instead.
warning: --depth is ignored in local clones; use file:// instead.
warning: --depth is ignored in local clones; use file:// instead.
cloneSourceRepo: OK (54.19s)
+++ OK, passed 10 tests.
syncSourceRepos: OK (57.73s)
+++ OK, passed 10 tests.
Let's make sure to add a couple test cases for shallow and non-shallow clones as well.
The --depth is ignored
warning can be seen in #10587 as well.
e93d885
to
c9388d9
Compare
@9999years what kind of property do you think we should test additionally? Since this PR, we test that short hashes work (which means doing a full clone). |
I don't understand why the whitespace test is failing. Perhaps @ulysses4ever or @geekosaur knows? This file is not in my tree?
|
It's in mine? (Careful: the failing file is a |
c9388d9
to
702e39e
Compare
Interestingly I managed to get the file only after rebasing. It was introduced in 33b19e4. |
I've patched it now, but note that the whitespace violation wasn't introduced in this PR. |
I have a sneaking suspicion that the whitespace job isn't listed as required under branch protection. Mergify doesn't care about CI passing, it cares only about the branch protection rules being satisfied. (And merges as soon as they pass even if CI is still running; I still haven't heard back from them about that.) ETA: confirmed, whitespace job isn't in branch protection rules. |
I'd suggest you remove the patches from this PR and make a separate one fixing the whitespace breakages, which we can push in at high priority if necessary since |
Sure. In #10642 |
I just noticed you're missing the PR templates both here and in the new PR. |
When the `tag` of a `source-repository-stanza` is not a full hash, we cannot do a shallow clone and fetch it separately. Therefore, in those cases, we fall back to doing a full clone. Fixes haskell#10605 Includes a regression test by @9999years. Co-authored-by: Rebecca Turner <rbt@sent.as>
The lack of parenthesis in this line meant that we'd only see the verbose output from git when we had a `peerLocalDir`. This should fix verbosity of git
2f62765
to
9406ecf
Compare
Oh no! I've just noticed that |
It turns out that git fetch origin tag will clone the full repository unless it is also given --depth=1 as an argument. This commit amends this oversight, ensuring source-repository-package stanzas with any tag don't have to fall back to fetch unnecessary information (which is coincidentally much faster)
9406ecf
to
a19c6e3
Compare
I've fixed this now in a new commit. @9999years What do you envision we could test additionally? |
The current property testing infrastructure for VCS uses local clones. This is problematic with shallow clones. In particular, the change that makes fetching a tag shallowly breaks the testsuite because the reference repository is shallow
It looks to me like the best path forward is to make local clones never shallow, which will make the property tests for VCS essentially incapable of testing shallow clones (here @9999years suggestion becomes much more relevant) |
Additionally
Template Α: This PR modifies behaviour or interface
Include the following checklist in your PR:
significance: significant
in the changelog file.