-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Batch Changes - commit message on stdin #55657
Conversation
Commit messages for batch changes can be arbitrary strings, so passing them inline to the command arguments using `-m` is prone to problems and edge cases. Solving those problems and edge cases is non-optimal, so pivot to using a different way to specify commit messages: from a file (stdin in this case). This allows commit messages to contain arbitrary characters without needing to worry about escaping or edge cases.
Codenotify: Notifying subscribers in CODENOTIFY files for diff 4ffba4e...06f2163.
|
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.
<3
return false | ||
} | ||
if strings.HasPrefix(arg, "-") { | ||
fmt.Printf("EVALUATING ARGUMENT %d: %s\n", i, arg) |
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.
fmt.Printf("EVALUATING ARGUMENT %d: %s\n", i, arg) |
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 don’t feel super strongly about the other comments, but I think we should address this one in a follow up 🙂
} | ||
|
||
// I hate state machines, but I hate them less than complicated multi-argument checking | ||
checkFileInput := false |
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.
can we get a test for this new added behavior?
// NOTE: join messages with a blank line in between ("\n\n") | ||
// because the previous behavior was to use multiple -m arguments, | ||
// which concatenate with a blank line in between. | ||
// Gerrit is the only code host that usees multiple messages at the moment |
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.
// Gerrit is the only code host that usees multiple messages at the moment | |
// Gerrit is the only code host that uses multiple messages at the moment |
Implemented suggestions to remove debug code, add test and fix typo
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-5.1 5.1
# Navigate to the new working tree
cd .worktrees/backport-5.1
# Create a new branch
git switch --create backport-55657-to-5.1
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 d1202d873566cf93c74833d5574340997a818c06
# Push it to GitHub
git push --set-upstream origin backport-55657-to-5.1
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-5.1 Then, create a pull request where the |
Commit messages for batch changes can be arbitrary strings, so passing them inline to the command arguments using `-m` is prone to problems and edge cases. Solving those problems and edge cases is non-optimal, so pivot to using a different way to specify commit messages: from a file (stdin in this case). This allows commit messages to contain arbitrary characters without needing to worry about escaping or edge cases. in a batch spec, use a commit message that contains newlines (use `message: |` followed by the message on the next line, indented more than `message`). Check the commit message on the code host after the patch has been published. You can include other characters in the commit message (one edge case we've seen is beginning the commit message with a dash) to ensure they are also handled correctly. (cherry picked from commit d1202d8)
Commit messages for batch changes can be arbitrary strings, so passing them inline to the command arguments using `-m` is prone to problems and edge cases. Solving those problems and edge cases is non-optimal, so pivot to using a different way to specify commit messages: from a file (stdin in this case). This allows commit messages to contain arbitrary characters without needing to worry about escaping or edge cases. ## Test plan in a batch spec, use a commit message that contains newlines (use `message: |` followed by the message on the next line, indented more than `message`). Check the commit message on the code host after the patch has been published. You can include other characters in the commit message (one edge case we've seen is beginning the commit message with a dash) to ensure they are also handled correctly.
Commit messages for batch changes can be arbitrary strings, so passing them inline to the command arguments using
-m
is prone to problems and edge cases.Solving those problems and edge cases is non-optimal, so pivot to using a different way to specify commit messages: from a file (stdin in this case). This allows commit messages to contain arbitrary characters without needing to worry about escaping or edge cases.
Test plan
in a batch spec, use a commit message that contains newlines (use
message: |
followed by the message on the next line, indented more thanmessage
). Check the commit message on the code host after the patch has been published.You can include other characters in the commit message (one edge case we've seen is beginning the commit message with a dash) to ensure they are also handled correctly.