-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Handle non-existent upstream master branches in x fmt
#106415
Conversation
I don't think we should fallback on an arbitrary remote, if your origin is way behind the current HEAD we'll do a bunch of work trying to figure out what the right delta is, but really just formatting all files in that case seems better to me. I don't think we should allow for our heuristics being wrong by using arbitrary remotes. |
@Mark-Simulacrum we already hardcode |
Hm, that seems like a problem there - I would probably not do that. But anyway, will leave it up to you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, that seems like a problem there - I would probably not do that. But anyway, will leave it up to you.
Yeah it's a little unfortunate. But people have been using it for 2+ years and no one has complained, so I think it's ok in practice.
r=me with the nit fixed
I agree that hardcoding remotes isn't a great idea, but I think it's fine here. This path will only be hit on fairly nonstandard setups that don't have the upstream master fetched, and also if it fails it will just be a warning and it will work just fine (albeit a little slower). |
21947c9
to
d5e5762
Compare
x fmt
x fmt
@bors r=jyn514 |
☀️ Test successful - checks-actions |
Finished benchmarking commit (7ac9572): comparison URL. Overall result: ❌✅ regressions and improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
|
Falling back to formatting all files." | ||
); | ||
// Something went wrong when getting the version. Just format all the files. | ||
paths.push(".".into()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've stared at this for quite a while now, but I don't think I get it... why does this push .
to the path list? We have other error cases below ("could not find usable git"), and they don't do that. Why is this different? I think for ./x.py fmt
it is unnecessary since we're anyway searching everything, and for ./x.py fmt compiler/
this s actively buggy since it formats not just the files in the compiler dir. Am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're probably right. i don't remember the details of this change though, but this does look sus
…ulacrum bootstrap/format: remove unnecessary paths.push Cc rust-lang#106415 (review) I verified that this still formats all fileds when `get_modified_rs_files` is made to return an error. r? `@Nilstrieb`
…ulacrum bootstrap/format: remove unnecessary paths.push Cc rust-lang#106415 (review) I verified that this still formats all fileds when `get_modified_rs_files` is made to return an error. r? ``@Nilstrieb``
Rollup merge of rust-lang#115440 - RalfJung:bootstrap-fmt, r=Mark-Simulacrum bootstrap/format: remove unnecessary paths.push Cc rust-lang#106415 (review) I verified that this still formats all fileds when `get_modified_rs_files` is made to return an error. r? ``@Nilstrieb``
People who do have a remote for
rust-lang/rust
but don't have the master branch checked out there used to get this error when runningx fmt
:Which is not exactly helpful.
Now, we fall back to
origin/master
(hoping that at least that remote exists) for that case. If there is still some error, we just fall back tox fmt .
and print a warning.r? @jyn514