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

Strip surrounding whitespace from commit message #29

Open
lociii opened this issue Aug 26, 2022 · 4 comments
Open

Strip surrounding whitespace from commit message #29

lociii opened this issue Aug 26, 2022 · 4 comments

Comments

@lociii
Copy link
Contributor

lociii commented Aug 26, 2022

Hey Kevin,

thanks a lot for your work on this really useful extension.
We set it up with a template that allows for optional details at the end of the message.

"vscodeGitCommit.template": [
	"{type}: {message}, {action} {reference}",
	"",
	"{details}"
]

Now if details are kept empty, we will end up with two empty lines in the commit message. It would be ideal if it could be stripped from whitespace at the end of the template processing. What do you think?

Thanks, Jens

@rioukkevin
Copy link
Owner

Hi, sorry for delay, that's a good idea, I look for your PR this week 😉

@rioukkevin
Copy link
Owner

I'm sorry I don't have time to test the extension with the PR, I do it this week for sure, I can unlock time tomorrow or thursday for it 😉

rioukkevin added a commit that referenced this issue Sep 30, 2022
Trim template result before setting git commit message, refs #29
@jamessampford
Copy link

Would it also be possible to trim each line (could be whitespace) and also replacing multiple 3+ new lines with just 2? For example, if have the below template:

"vscodeGitCommit.template": [
	"{type}: {message}, {action} {reference}",
	"",
	"{details}",
	"",
	"{issue_reference}"
]

If details were optional, there would be a large space between the first and last lines

@rioukkevin
Copy link
Owner

Would it also be possible to trim each line (could be whitespace) and also replacing multiple 3+ new lines with just 2? For example, if have the below template:

"vscodeGitCommit.template": [
	"{type}: {message}, {action} {reference}",
	"",
	"{details}",
	"",
	"{issue_reference}"
]

If details were optional, there would be a large space between the first and last lines

@jamessampford the idea is good, but it can't be automatic, it probably create unwanted things, so I add a settings property for it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants