-
Notifications
You must be signed in to change notification settings - Fork 45
Implement @bors squash (take two)
#645
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
Conversation
| // Create the squashed commit on the source repository. | ||
| // We take the parents of the first commit, and the tree of the last commit, to create the | ||
| // squashed commit. | ||
| let commit_msg = &pr.github.title; |
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 would lose the original commit messages. I don't know of an easy heuristic for that though. Another option may be to pick the PR description and remove the bors ignored part, all closes commands and the r?. Or maybe allow giving the commit message as argument to @bors squash?
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 implemented this as an MVP, mostly to check permissions. There is a pretty big design aspect left, and that is how to generate the commit message, exactly as you say 😆 Let's discuss that on Zulip.
|
Error: This repository is not enabled to use triagebot. Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip. |
1 similar comment
|
Error: This repository is not enabled to use triagebot. Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip. |
| // Fetch the commit from the source repo | ||
| source_remote | ||
| .fetch(&[commit_sha.as_ref()], Some(&mut fetch_options), None) | ||
| .with_context(|| anyhow::anyhow!("Cannot fethc commit {commit_sha} from {source_repo}"))?; |
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.
Wouldn't this clone the entire repo? Can you use fetch_options.depth(1) to at least skip all history? Looks like libgit2 doesn't support partial clones though, so you can't do the equivalent of --filter=tree:0 to avoid downloading any blobs and trees at all.
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.
...crap, I thought it was too easy. Yeah, this will have to be handled somehow (possibly with a disk cache :( ).
Second attempt, this time using
libgit2to perform the push of the squashed commit to a fork, and with tests.I hid the
libgit2dependency behind a feature, to make it easier for contributors who can't build that dependency (although it is enabled by default).