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

git: do not validate submodules of fresh checkouts #14605

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

osiewicz
Copy link
Contributor

Fixes #14603

What does this PR try to resolve?

As is, we unconditionally validate freshness of the submodules of a checkout, even though we could assume that a fresh checkout has to have up-to-date submodules as well.

How should we test and review this PR?

N/A

Additional information

N/A

@rustbot
Copy link
Collaborator

rustbot commented Sep 27, 2024

r? @weihanglo

rustbot has assigned @weihanglo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-git Area: anything dealing with git S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 27, 2024
Comment on lines 183 to 190
Some(co) => co,
None => GitCheckout::clone_into(dest, self, rev, gctx)?,
None => {
let checkout = GitCheckout::clone_into(dest, self, rev, gctx)?;
checkout.update_submodules(gctx)?;
checkout
}
};
checkout.update_submodules(gctx)?;

Copy link
Contributor

@epage epage Sep 27, 2024

Choose a reason for hiding this comment

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

is_fresh is determined by the presence of the CHECKOUT_READY_LOCK file. That file is written in reset which is called at the end of clone_into. As-written in this PR, if the submodule update fails or gets interrupted, we won't be able to detect that and recover on the next invocation. We need to make sure that CHECKOUT_READY_LOCK is not written to until after the submodule update to make sure we can recover gracefully.

@epage
Copy link
Contributor

epage commented Sep 27, 2024

We likely should update _corrupted_checkout test to have a submodule to show that we recovery gracefully on interruption,

}

impl CheckoutGuard {
#[must_use]
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be put on the struct itself?

@epage
Copy link
Contributor

epage commented Oct 1, 2024

Could you update the commits to be how you want them reviewed and merged?

For example, I could see this being

  • Test commit
  • Refactor for checkout guard
  • Improve performance by adjusting the scope of the checkout guard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-git Area: anything dealing with git S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Loading of a git source is slow due to always checking if the submodule is updated
4 participants