-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
bootstrap submodule sync overwrites local changes #103485
Comments
There is an option in We'd better get confirmation if there is no explicit config parameter get from |
This has been a frequent source of surprises for me as well going back all the way to the addition of |
I think a simple fix would be to use git stash + git apply to save changes before doing a hard reset; if that causes issues for some reason, we can remove all the |
Can I work on this issue? Though I need Some guidance I am new to the project |
@pratushrai0309 first, reproduce the original issue so you can be sure your changes are having an effect. Then modify the git commands linked in the original post (#103485 (comment)) to add |
So what exactly I should do to reproduce the original Issue. This is my first time contributing to the compiler. |
@rustbot claim |
That's what I have done self.run(Command::new("git").args(&["stash", "save"]).current_dir(&absolute_path));
self.run(Command::new("git").args(&["stash", "apply"]).current_dir(&absolute_path));
self.run(Command::new("git").args(&["reset", "-q", "--hard"]).current_dir(&absolute_path));
self.run(Command::new("git").args(&["clean", "-qdfx"]).current_dir(absolute_path)); |
@pratushrai0309 Maybe a Zulip thread is a better place to show your result and receive more feedback on the solution |
@pratushrai0309 |
Yeah! It was a mistake thanks for pointing out |
I have done the intended changes and opened a PR #103810 . |
Don't overwrite local changes when updating submodules Fixes rust-lang#103485
When bootstrap updates a submodule, it performs a hard reset, discarding all local changes:
rust/src/bootstrap/lib.rs
Lines 631 to 632 in 1481fd9
This was a nasty surprise when I was editing my local
src/llvm-project
, and then did agit pull
and./x.py build
.Fortunately, I only had some extra debugging prints added, but there was no indication that my local changes would be overwritten.
We should require explicit confirmation before potentially deleting local changes like this.
The text was updated successfully, but these errors were encountered: