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

Handling submodule update failures more gracefully from x.py #89929

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,15 @@ def update_submodule(self, module, checked_out, recorded_submodules):
if self.git_version >= distutils.version.LooseVersion("2.11.0"):
update_args.append("--progress")
update_args.append(module)
run(update_args, cwd=self.rust_root, verbose=self.verbose, exception=True)
try:
run(update_args, cwd=self.rust_root, verbose=self.verbose, exception=True)
except RuntimeError:
print("Failed updating submodule. This is probably due to uncommitted local changes.")
print('Either stash the changes by running "git stash" within the submodule\'s')
print('directory, reset them by running "git reset --hard", or commit them.')
print("To reset all submodules' changes run", end=" ")
print('"git submodule foreach --recursive git reset --hard".')
raise SystemExit(1)
Mark-Simulacrum marked this conversation as resolved.
Show resolved Hide resolved

run(["git", "reset", "-q", "--hard"],
cwd=module_path, verbose=self.verbose)
Expand Down