This repository was archived by the owner on Dec 15, 2022. It is now read-only.
make commit message template ignore commented lines #1902
Merged
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.
Description of the Change
This change fixes a bug where commit message templates that include commented lines were included in the body of the commit.
If a commit template exists, istrip commented lines from the commit message.
Alternate Designs
My initial approach had us ignoring the
verbatimflag if a commit template was present. However, we want to preserve the verbatim flag because otherwise commits made from the mini editor might be formatted weirdly in some cases. See Revisit commit message processing #1500 for more info.We discussed ripping out the
verbatimflag entirely, to aid complexity, but wanted to maintain the hard wrapping so as not to break formatting for users who are using the mini editor but not using a template.Benefits
Possible Drawbacks
#Applicable Issues
#1817
Metrics
N/A
Tests
#characters. Verified that those commented lines did not show up when usinggit logto inspect the commit.git-shell-out-strategyto verify that commented lines are stripped when using commit message templates. (We already have a unit test for validating that commented lines are not stripped, if a commit template does not exist.)Documentation
Added some code comments.
Release Notes
Fixed an issue where commits made with commit message templates were not stripping comment characters.