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
Allow ignoring comment lines in commits from files #2
Allow ignoring comment lines in commits from files #2
Conversation
8ea0cd6
to
9d8ffcd
Compare
Nice! Thanks for making the effort. I have three questions regarding this.
And this is also a comment line
If so, we should Secondly a note to your concern. So far the
So we could keep the comment lines in And lastly a taste thing, wouldn't it be "cleaner" to set the default for Thanks again, looking forward for your opinion. Cheers, Sebastian |
Those sound like some great improvements, I'll get on making those changes, I actually toyed with putting the logic inside the CommitMessage but it was a larger change and I wanted your feedback before I went for that. I wasn't sure about the whitespace thing, but apparently it does have to be right at the start of the line:
|
30958a3
to
f5376ee
Compare
That's done now. You might however notice that the CommitMessage defaults the character The from file method defaults to '#' however. The lines with the comments can still be accessed via getLines methods, |
f5376ee
to
6d5e57a
Compare
When git is creating a commit, the message it reads from a file does not include the lines beginning with a comment character. This means that the commit files that you get passed with a git commit message hook is not exactly what will appear in git if saved. The comment character in versions of git later than 1.8.2 is configurable, in versions prior to that it's always '#'. You might however notice that the CommitMessage defaults the character to null. This is because a commit message from the repository may have had any comment character set when it was created, so you could see lines in a commit message from the repository that begin with what is now the comment character. The lines with the comments can still be accessed via getLines methods, however the semantic methods of getBody and getSubject do not return them.
6d5e57a
to
90f883d
Compare
Looks great! |
I made a slight adjustment, the method
|
That sounds sensible
On Sat, 22 Apr 2017, 13:35 Sebastian Feldmann, ***@***.***> wrote:
I made a slight adjustment, the method getContent now returns the content
*without* comments.
To get the content including all comments I added a getRawContent method.
This way if we "talk" about the content we always "talk" about the
message without the comments.
- getContentLines
- isEmpty
- and now getContentas well
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAIIz2WG1WGN7CZAq_0bawFKMtR_U858ks5ryfQTgaJpZM4NE_bQ>
.
--
Billie Thompson
Software Developer
Purple Booth Ltd
Mob: 07813452516
Web: purplebooth.co.uk
Keybase: <http://billie.codes/1NOw29c>
LinkedIn: <http://billie.codes/1KT8gcI>
Twitter: <http://billie.codes/1SGPMCw>
|
Thanks again, I just tagged version 1.0.3 |
When git is creating a commit, the message it reads from a file does
not include the lines beginning with a comment character. This means
that the commit files that you get passed with a git commit message
hook is not exactly what will appear in git.
The comment character in versions of git later than 1.8.2 is
configurable, in versions prior to that it's always '#'.
In this implementation we do not preserve the comment lines at all.