Skip to content

x.py could handle submodule checkout failure more gracefully #80498

Closed
@matthiaskrgr

Description

@matthiaskrgr

If x.py can't check out the right commit of a submodule because the submodule has local edits that would be overwritten by the checkout, it crashes:


Updating only changed submodules
Updating submodule src/tools/rls
error: Your local changes to the following files would be overwritten by checkout:
	.dependabot/config.yml
Please commit your changes or stash them before you switch branches.
Aborting
Unable to checkout '2cf84baa5e3c55ac02f42919e67440acb5417125' in submodule path 'src/tools/rls'
Traceback (most recent call last):
  File "./x.py", line 11, in <module>
    bootstrap.main()
  File "/home/matthias/vcs/github/rust/src/bootstrap/bootstrap.py", line 1094, in main
    bootstrap(help_triggered)
  File "/home/matthias/vcs/github/rust/src/bootstrap/bootstrap.py", line 1060, in bootstrap
    build.update_submodules()
  File "/home/matthias/vcs/github/rust/src/bootstrap/bootstrap.py", line 924, in update_submodules
    self.update_submodule(module[0], module[1], recorded_submodules)
  File "/home/matthias/vcs/github/rust/src/bootstrap/bootstrap.py", line 866, in update_submodule
    run(update_args, cwd=self.rust_root, verbose=self.verbose, exception=True)
  File "/home/matthias/vcs/github/rust/src/bootstrap/bootstrap.py", line 153, in run
    raise RuntimeError(err)
RuntimeError: failed to run: git submodule update --init --recursive --progress src/tools/rls

Perhaps this could be handled more gracefully (with some hints on how to revert the changes to the submodule, perhaps?)

Metadata

Metadata

Assignees

Labels

A-contributor-roadblockArea: Makes things more difficult for new or seasoned contributors to RustC-bugCategory: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions