Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Revisit commit message processing #1500

Merged
merged 11 commits into from
Jun 1, 2018
Merged

Conversation

smashwilson
Copy link
Contributor

@smashwilson smashwilson commented Jun 1, 2018

Revisit the ways that we preprocess commit messages - both in JavaScript and in choosing a --cleanup argument to git commit - to better handle some edge cases and bugs.

  • Fixes Ammend commit message is corrupted in certain cases since atom 1.27.0 #1465. It turns out that GitShellOutStrategy.getHeadCommit() was stripping newlines from the message body of any parsed commit, which was altering amended commit messages. Added --cleanup=verbatim as well to ensure that the message isn't manipulated by git either.
  • Fixes Auto-wrap removed text from commit message #1382 by adding a {verbatim} option to GitShellOutStrategy.commit(). When set to true, the message argument is used for the commit exactly as-is. When set to false, if commit.cleanup is set to a value and is not "default", default to "strip".
    • Don't generate the "merge text" commit message template when a merge is detected (because we would no longer strip out the # lines).
    • Set {verbatim: true} when committing from the mini editor, but not from a full editor.

Note that I'm defaulting --cleanup to "strip" for non-verbatim commits instead of "whitespace". My logic here is that committing through Atom with a full-editor message feels more like editing a message in $EDITOR and committing than it does doing a commit -m, so we want to act like git "when the message is to be edited":

Same as strip if the message is to be edited. Otherwise whitespace.

@smashwilson smashwilson merged commit 81c6bf2 into master Jun 1, 2018
@smashwilson smashwilson deleted the aw/commit-message-wrapping branch June 1, 2018 13:39
smashwilson added a commit that referenced this pull request Jun 1, 2018
smashwilson added a commit that referenced this pull request Jun 1, 2018
smashwilson added a commit that referenced this pull request Jun 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant