]> git.lizzy.rs Git - rust.git/commitdiff
Handling submodule update failures more gracefully from x.py
authorYuval Dolev <yuvaldolev2@gmail.com>
Fri, 15 Oct 2021 22:33:05 +0000 (01:33 +0300)
committerYuval Dolev <yuvaldolev2@gmail.com>
Fri, 15 Oct 2021 22:38:57 +0000 (01:38 +0300)
src/bootstrap/bootstrap.py

index 0170be967e1e307c2410a53a77f1a719eda247e2..f0159280372773f6ab63a6cac5a2272d9f97b100 100644 (file)
@@ -1005,7 +1005,15 @@ class RustBuild(object):
         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)
 
         run(["git", "reset", "-q", "--hard"],
             cwd=module_path, verbose=self.verbose)