Skip to content
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

gitmodules: Disable update to prevent cloning on cargo checkout #808

Merged
merged 1 commit into from
Oct 30, 2023

Conversation

MarijnS95
Copy link
Collaborator

When using a git reference on this repo, cargo will unnecessarily clone the Vulkan-Headers submodule (which is only needed by maintainers together with the generator). By setting the update mode to none (https://git-scm.com/docs/gitmodules#Documentation/gitmodules.txt-submoduleltnamegtupdate) this is disabled, and git submodule update will now also no longer fetch/clone/update the repository unless --checkout is used (https://git-scm.com/docs/git-submodule#Documentation/git-submodule.txt-checkout).

I.e. running cargo update on a repo with a git dependency on ash:

Updating git repository `https://github.com/ash-rs/ash`
Skipping git submodule `https://github.com/KhronosGroup/Vulkan-Headers` due to update strategy in .gitmodules

Copy link
Collaborator

@Ralith Ralith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

When using a `git` reference on this repo, `cargo` will unnecessarily
clone the `Vulkan-Headers` submodule (which is only needed by maintainers
together with the `generator`).  By setting the update mode to `none`
(https://git-scm.com/docs/gitmodules#Documentation/gitmodules.txt-submoduleltnamegtupdate)
this is disabled, and `git submodule update` will now also no longer
fetch/clone/update the repository unless `--checkout` is used
(https://git-scm.com/docs/git-submodule#Documentation/git-submodule.txt-checkout).

I.e. running `cargo update` on a repo with a `git` dependency on `ash`:

    Updating git repository `https://github.com/ash-rs/ash`
    Skipping git submodule `https://github.com/KhronosGroup/Vulkan-Headers` due to update strategy in .gitmodules
Comment on lines -36 to +37
submodules: true
- name: Checkout submodule
# Manually update submodules with --checkout because they are configured with update=none and will be skipped otherwise
run: git submodule update --recursive --init --force --checkout
Copy link
Collaborator Author

@MarijnS95 MarijnS95 Oct 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JFYI, I tested whether setting submodules: checkout might be an undocumented feature where --checkout is added to the submodule update command, but no dice. It only seems to check for == "true".

@MarijnS95 MarijnS95 merged commit 4180359 into master Oct 30, 2023
22 checks passed
@MarijnS95 MarijnS95 deleted the submodule-disable-update branch October 30, 2023 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants