Skip to content

Commit 95ae868

Browse files
author
Yuval Dolev
committed
Handling submodule update failures more gracefully from x.py
1 parent c102653 commit 95ae868

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/bootstrap/bootstrap.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,15 @@ def update_submodule(self, module, checked_out, recorded_submodules):
10051005
if self.git_version >= distutils.version.LooseVersion("2.11.0"):
10061006
update_args.append("--progress")
10071007
update_args.append(module)
1008-
run(update_args, cwd=self.rust_root, verbose=self.verbose, exception=True)
1008+
try:
1009+
run(update_args, cwd=self.rust_root, verbose=self.verbose, exception=True)
1010+
except RuntimeError:
1011+
print("Failed updating submodule. This is probably due to uncommitted local changes.")
1012+
print('Either stash the changes by running "git stash" within the submodule\'s')
1013+
print('directory, reset them by running "git reset --hard", or commit them.')
1014+
print("To reset all submodules' changes run", end=" ")
1015+
print('"git submodule foreach --recursive git reset --hard".')
1016+
raise SystemExit(1)
10091017

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

0 commit comments

Comments
 (0)