-
Notifications
You must be signed in to change notification settings - Fork 13k
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.py: use git rev-list
for robustness
#87532
Conversation
When determining which LLVM artifacts to download, bootstrap.py calls: `git log --author=bors --format=%H -n1 -m --first-parent -- src/llvm-project src/bootstrap/download-ci-llvm-stamp src/version`. However, the `-m` option has no effect, per the `git log` help: > -m > This option makes diff output for merge commits to be shown in the > default format. -m will produce the output only if -p is given as > well. The default format could be changed using log.diffMerges > configuration parameter, which default value is separate. Accordingly, this commit removes use of the -m option in favor of `--no-patch`, to make clear that this command should never output diff information, as the SHA-1 hash is the only desired output. Tested using git 2.32, this does not change the output of the command. The motivation for this change is that some patched versions of git change the behavior of the `-m` flag to imply `-p`, rather than to do nothing unless `-p` is passed. These patched versions of git lead to this script not working. Google's corp-provided git is one such example.
Use `git rev-list` instead of `git log` to be more robust against UI changes in git. Also, use the full email address for bors, because `--author` uses a substring match.
I don't see why we would. The reason to use
Hmm, the man page says:
I don't know why we use this in the LLVM download - I'm not confident that the first parent will always be the one with a bors author, and Either way I don't expect it to make a big difference, we say pretty clearly on https://rustc-dev-guide.rust-lang.org/git.html#no-merge-policy that you shouldn't use merge commits. |
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.
This looks good to me.
author=bors is insufficient (in general) because clippy and potentially other repos also use bors but (obviously) don't upload the full set of rustc artifacts (or any artifacts at all today). I believe first parent means we traverse the chain of commits appropriately, always going along rust-lang/rust bors merges. |
I think bors might only run the CI on its auto-merge commits, not its non-merge commits? But I'd want to check with someone who knows bors/homu better.
I think that
Most of the non-bors merge commits that I see at a casual glance seem to be parts of rollup merges. Details on non-merge bors commits:
but
produces no output. Also, digging through So now I'm leaning towards yes on |
Only look for commits by bors that are merge commits, because those are the only ones with CI artifacts. Also, use `--first-parent` to avoid traversing stuff like rollup branches.
Pushed an update. Now both of them use |
Looks like #87513 has merged; should I rebase and/or squash? |
@tlyu I don't think you need to, there aren't conflicts. |
@bors r+ I'm not sure I buy that this is avoiding clippy commits, but it doesn't seem any worse than before, and we can fix it if something goes wrong. |
📌 Commit e0d7a59 has been approved by |
☀️ Test successful - checks-actions |
Use
git rev-list
instead ofgit log
to be more robust againstUI changes in git. Also, use the full email address for bors,
because
--author
uses a substring match.Based on #87513, but is separate because it's less minimal and may require additional manual testing.
Open questions:Should themerge_base
search also use--first-parent
?Do we exclude non-merge commits from bors? There are a few, and I'm not sure what they have in common. Some of them look like squashes, and some look like they're in rollup branches.r? @jyn514
@rustbot label +A-rustbuild +C-cleanup