[1/1]: Stop spamming everyone with empty messages#54
Merged
slinder1 merged 1 commit intoJun 24, 2026
Merged
Conversation
The idea with the "Changes since last push: none" comments was to make it clear that a force-push was just incidental to the stacking hack. In practice a couple of rebases or changes in other commits in the stack could lead to the comment being repeated several times in a short period, which is understandably annoying. I still think comments for *actual interdiffs* are useful enough to retain. Change-Id: I00742310e87ee0d7ca9aa2174213cccff6b0ece2
Owner
Author
🛠️ Initial changes (click to expand):diff --git b/src/cgh.rs a/src/cgh.rs
@@ -152,6 +152,7 @@ fn push(cfg: &cli::Push) -> Result<()> {
changes
.par_iter()
.zip(diffs)
+ .filter(|(c, _)| c.is_nonempty())
.map(|(c, diff)| c.pr.add_details_comment(&diff))
.collect::<Result<Vec<_>>>()
.context("could not add interdiff comments")?;
diff --git b/src/gh.rs a/src/gh.rs
@@ -150,15 +150,14 @@ impl Pr {
pub fn add_details_comment(&self, diff: &Diff) -> Result<()> {
let (summary, changes) = match diff {
Diff::InitialDiff(text) => ("Initial changes", text),
- Diff::InterDiff(text) => ("Changes since last push", text),
- };
- let comment = if changes.is_empty() {
- format!("🛠️ {summary}: none (likely a rebase)")
- } else {
- format!(
- "<details>\n<summary>🛠️ {summary} (click to expand):</summary>\n\n```diff\n{changes}\n```\n</details>"
- )
+ Diff::InterDiff(text) => ("Changes since last version", text),
};
+ if changes.is_empty() {
+ return Ok(());
+ }
+ let comment = format!(
+ "<details>\n<summary>🛠️ {summary} (click to expand):</summary>\n\n```diff\n{changes}\n```\n</details>"
+ );
let mut body_arg = ArgInlineOrFile::new("body");
let mut cmd = gh();
let args = self.args_for("comment", [body_arg.arg(comment)?]);
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The idea with the "Changes since last push: none" comments was to make
it clear that a force-push was just incidental to the stacking hack. In
practice a couple of rebases or changes in other commits in the stack
could lead to the comment being repeated several times in a short
period, which is understandably annoying.
I still think comments for actual interdiffs are useful enough to
retain.
Change-Id: I00742310e87ee0d7ca9aa2174213cccff6b0ece2
Stack:
main(Note: Closed and merged PRs may not be reflected here and PR numbering is not stable.)