-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add handle of git scissors cleanup and custom comment char #34
Add handle of git scissors cleanup and custom comment char #34
Conversation
Git commit command has `cleanup` argument ( https://git-scm.com/docs/git-commit#git-commit---cleanupltmodegt) which can clean up commit messages after some cutline. This cutline appears when you make commit with git commit -v (-v, --verbose add diff to commit message) This commit add cutting of commit message after this cutline
Git has oppurtunity to set custom comment char. Add retriving this char from config and handle on message parsing
@@ -4,3 +4,6 @@ This is the first line of the commit message body and it is meant to test a line | |||
This line has a tråiling space. | |||
This line has a trailing tab. | |||
# This is a cömmented line | |||
# ------------------------ >8 ------------------------ |
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 think we should add some non-commented text after the cutline to properly test this use-case since commented lines are being ignored regardless.
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.
Fixed
Thank you very much for submitting this PR! Except for the minor comment I left in the code review, this looks really good. I will try to get a release out that includes these and some other changes within the next 2 weeks. |
Suggested by @jorisroovers to properly test use-case for git scissors line since commented lines are being ignored regardless.
Merged! Thanks :) I'll be working a releasing this and some other patches soon. |
This commit introduces the gitlint.git._git(...) convenience function for executing git commands. The main benefit of this is that all error and unicode handling of git commands is now uniform as it's done in a single place. In addition, this refactor has the effect of the 'sh' library only being invoked in a single place in the entire gitlint codebase. This will make it easier to replace it in the future, for example when we'd consider adding Windows support (see #20). This commit also fixes some unit tests related to custom comment chars as introduced by #34.
The 0.9.0 release adds a new default author-valid-email rule, important bugfixes and special case handling. Special thanks to joshholl, ron8mcr, omarkohl, domo141, nud and AlexMooney for their contributions. - New Rule: author-valid-email enforces a valid author email address. Details can be found in the Rules section of the documentation. - Breaking change**: The --commits commandline flag now strictly follows the refspec format as interpreted by the git rev-list <refspec> command. This means that linting a single commit using gitlint --commits <SHA> won't work anymore. Instead, for single commits, users now need to specificy gitlint --commits <SHA>^...<SHA>. On the upside, this change also means that gitlint will now understand all refspec formatters, including gitlint --commits HEAD to lint all commits in the repository. This fixes #23. - Breaking change**: Gitlint now always falls back on trying to read a git message from a local git repository, only reading a commit message from STDIN if one is passed. Before, gitlint only read from the local git repository when a TTY was present. This is likely the expected and desired behavior for anyone running gitlint in a CI environment. This fixes #40 and #42. - Behavior Change**: Gitlint will now by default ignore squash and fixup commits (fix for #33). - Support for custom comment characters (#34). - Support for 'git commit --cleanup=scissors' (#34). - Bugfix: #37: Prevent Commas in text fields from breaking git log printing - Debug output improvements Full Release details in CHANGELOG.md.
The 0.9.0 release adds a new default author-valid-email rule, important bugfixes and special case handling. Special thanks to joshholl, ron8mcr, omarkohl, domo141, nud and AlexMooney for their contributions. - New Rule: author-valid-email enforces a valid author email address. Details can be found in the Rules section of the documentation. - Breaking change**: The --commits commandline flag now strictly follows the refspec format as interpreted by the git rev-list <refspec> command. This means that linting a single commit using gitlint --commits <SHA> won't work anymore. Instead, for single commits, users now need to specificy gitlint --commits <SHA>^...<SHA>. On the upside, this change also means that gitlint will now understand all refspec formatters, including gitlint --commits HEAD to lint all commits in the repository. This fixes jorisroovers#23. - Breaking change**: Gitlint now always falls back on trying to read a git message from a local git repository, only reading a commit message from STDIN if one is passed. Before, gitlint only read from the local git repository when a TTY was present. This is likely the expected and desired behavior for anyone running gitlint in a CI environment. This fixes jorisroovers#40 and jorisroovers#42. - Behavior Change**: Gitlint will now by default ignore squash and fixup commits (fix for jorisroovers#33). - Support for custom comment characters (jorisroovers#34). - Support for 'git commit --cleanup=scissors' (jorisroovers#34). - Bugfix: jorisroovers#37: Prevent Commas in text fields from breaking git log printing - Debug output improvements Full Release details in CHANGELOG.md.
Fix cleaning up commit message when
git commit -v
command used.Git adds special cutline (scissors) when using with
-v
arg. Lines after this one will not be included to commitSee --verbose arg description and scissors clean up description in docs for details
Also add handle of custom comment char see
core.commentChar
setting