Current_git: ensure stale submodules are removed#345
Current_git: ensure stale submodules are removed#345tmcgilchrist merged 3 commits intoocurrent:masterfrom
Conversation
|
What if we keep the old code and also do |
|
I don't think deinit affects the caching:
|
I missed that, thanks. |
|
Thanks for grasping this one! Does it still fix the original problem which is where the submodule URL changes? |
|
It’s the scenario described in #320 (comment) - I think from my experiments, |
- Do `git submodule deinit` first, otherwise git won't remove old files on reset. - Add a test for this. I also removed the extra submodule update and sync added recently. The sync only affects initialised submodules and there aren't any with this change. The extra update was to help the sync succeed.
Calling `deinit` prevents `sync` from working. We now also fetch the submodules in the `fetch` step, not in the checkout.
Ah, you're right! If you deinit a submodule and then reinit it, it reuses the address from before the deinit instead of reinitialising it. How annoying. I've added a second commit with a test for moving a submodule's repository and made some fixes for it. We now also fetch submodules during the |
This reverts commit ef24ca3, which causes checkouts to fail with e.g. error: pathspec 'refs/pull/449/head' did not match any file(s) known to git
|
I also reverted "Checkout to the correct branch in with_checkout" from #333, since it prevents building PRs and therefore makes testing this difficult. |
|
I'm not sure that this FROM ocaml/opam AS base
RUN git clone https://github.com/ocurrent/ocluster.git --recursive
WORKDIR ocluster
FROM base
RUN sed -i -e s/ocurrent/dra27/ .gitmodules
RUN git submodule sync
RUN grep 'url = .*/obuilder\.git' * .git* -rI
FROM base
RUN rm -rf *
RUN git reset --hard HEAD
RUN sed -i -e s/ocurrent/dra27/ .gitmodules
RUN git submodule sync
RUN git submodule deinit --all --force
RUN git submodule update --init --recursive
RUN grep 'url = .*/obuilder\.git' * .git* -rIIn the first run, with the checkout as normal, we see: the second run attempts to simulate the default state of an OCurrent .git cache - which should be just a
|
|
The URLs shouldn't matter in the checkout (after copying Cmd.git_submodule_update ~init:true ~cancellable:true ~fetch:false ~job ~repo:tmpdir |
|
Oh, I get it, now, thanks! |
…, current_github, current_git, current_examples, current_docker and current (0.6.1) CHANGES: Web UI: - UI restyle, embed files using ocaml-crunch. (@ewanmellor, @MisterDA, ocurrent/ocurrent#315) - Automatically refresh some pipeline pages. (@MisterDA, ocurrent/ocurrent#227) - Allow to import and export using CSV the log rules. (@MisterDA, ocurrent/ocurrent#327) - Log matcher takes the pattern with the highest score (@kit-ty-kate, ocurrent/ocurrent#335) API: - GitHub: Add pp_short for commit and fix url link for GH commits. (@tmcgilchrist, ocurrent/ocurrent#347) - GitHub: Fetch commit messages for commits on GitHub (@punchagan, ocurrent/ocurrent#337) - GitHub: Add Current_github.Api.cmdliner_opt. (@dra27, ocurrent/ocurrent#338) - GitHub: Add extra PR information to Ref.t (@tmcgilchrist @TheLortex, ocurrent/ocurrent#336) Plugins: - GitLab: support GitLab clone fork and fetch MR branch. (@MisterDA, ocurrent/ocurrent#346) - Git: Fix handling of git repositories with submodules. (@talex5, ocurrent/ocurrent#345) - GitLab: Fix ref filtering bug for GitLab (@tmcgilchrist, ocurrent/ocurrent#332) Other: - Add missing dependencies on Unix (@dra27, ocurrent/ocurrent#331)
git submodule deinitfirst, otherwise git won't remove old files on reset.I also removed the extra submodule update and sync added recently. The sync only affects initialised submodules and there aren't any with this change. The extra update was to help the sync succeed.
Fixes #340.