Skip to content
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

Merged
merged 3 commits into from Jul 14, 2017
Merged

Add handle of git scissors cleanup and custom comment char #34

merged 3 commits into from Jul 14, 2017

Conversation

ron8mcr
Copy link
Contributor

@ron8mcr ron8mcr commented Jun 29, 2017

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 commit

See --verbose arg description and scissors clean up description in docs for details

Also add handle of custom comment char see core.commentChar setting

@ron8mcr ron8mcr changed the title Add handle of custom commit char and git scissors cleanup Add handle of git scissors cleanup Jun 29, 2017
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
@ron8mcr ron8mcr changed the title Add handle of git scissors cleanup Add handle of git scissors cleanup and custom commit char Jun 29, 2017
Git has oppurtunity to set custom comment char.
Add retriving this char from config and handle on message parsing
@ron8mcr ron8mcr changed the title Add handle of git scissors cleanup and custom commit char Add handle of git scissors cleanup and custom comment char Jun 29, 2017
@@ -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 ------------------------
Copy link
Owner

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@jorisroovers
Copy link
Owner

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.
@jorisroovers jorisroovers merged commit bc05276 into jorisroovers:master Jul 14, 2017
@jorisroovers
Copy link
Owner

Merged! Thanks :) I'll be working a releasing this and some other patches soon.

jorisroovers added a commit that referenced this pull request Jul 15, 2017
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.
jorisroovers added a commit that referenced this pull request Dec 3, 2017
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.
RykHawthorn pushed a commit to RykHawthorn/gitlint that referenced this pull request Jan 12, 2018
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants