Thanks to visit codestin.com
Credit goes to github.com

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

respect core.commentChar from git settings. #1988

Merged
merged 3 commits into from
Feb 27, 2019

Conversation

annthurium
Copy link

Description of the Change

If a user is using commit templates, previously we were assuming their comment character is #. Git provides the ability to set a custom comment char. This change respects a custom comment character the user has set and strips lines beginning with that character from the commit message.

Also, I made the original unit test for stripping # from commit message templates more robust, by adding some lines to the commit message that start with '#'. There were lines in the commit message template that start with '#', but we aren't actually doing anything with the template in gitShellOutStrategy.commit other than checking for existence, so that test wasn't checking anything very meaningful.

Screenshot/Gif

N/A

Alternate Designs

None.

Benefits

Users who have set a custom comment character will be able to make commits and ensure that commented characters are properly stripped.

Possible Drawbacks

There's always the risk of introducing additional bugs. Other than that, can't think of any.

Applicable Issues

#1909

Metrics

N/A

Tests

  • Manual testing setting core.commentChar in local git settings, setting a commit template that contained lines that start with that character, making a commit, and verifying that lines that started with that character are stripped out of the commit.
  • Manual tested unsetting core.commentChar, setting a commit template, making a commit, and verifying that lines that started with # were still stripped out of the ensuing commit message.
  • Added unit test to ensure that lines that start with core.commentChar are stripped from commit messages

Documentation

N/A

Release Notes

Fixed bug with commit message templates in the GitHub package -- now, lines starting with core.commentChar are stripped if core.commentChar is set in local git settings.

User Experience Research (Optional)

N/A

@annthurium annthurium requested a review from a team February 26, 2019 22:31
@codecov
Copy link

codecov bot commented Feb 26, 2019

Codecov Report

Merging #1988 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1988      +/-   ##
==========================================
+ Coverage   92.12%   92.12%   +<.01%     
==========================================
  Files         188      188              
  Lines       10806    10809       +3     
  Branches     1581     1582       +1     
==========================================
+ Hits         9955     9958       +3     
  Misses        851      851
Impacted Files Coverage Δ
lib/git-shell-out-strategy.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e2bc2ca...507f686. Read the comment docs.

Copy link
Contributor

@smashwilson smashwilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✨ Nice!

@annthurium annthurium merged commit 3ce6051 into master Feb 27, 2019
@annthurium annthurium deleted the tt-19-feb-core-commentchar branch February 27, 2019 16:09
@vanessayuenn vanessayuenn mentioned this pull request Mar 6, 2019
9 tasks
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.

2 participants