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

Support for commentchar=auto, always respect --edit #1660

Merged
merged 10 commits into from
Jan 23, 2018
Merged

Conversation

mislav
Copy link
Owner

@mislav mislav commented Jan 23, 2018

This is a significant refactor to code that processes -m, -F, and --edit flags, making --edit always respected even if -m was provided, and changes the logic that strips commented lines and splits content into title and body to be more consistent.

This also adds support for git config core.commentchar auto. Fixes #1512

mislav added 10 commits July 31, 2017 17:33
Before, the code outside of `editor.go` was responsible for prefixing
lines of the commented section with the comment char. The code to do
this was scattered all over the codebase and was difficult to refactor
re: adding support for `commentchar=auto`.

Now, Editor has a `AddCommentedSection()` method that allows for
declarative adding of a commented section. Furthermore, the caller
doesn't have to query git to determine the comment char.
Previously, passing `--edit` in combination with `-m` would skip opening
the editor. For compatibility with `git commit`, `--edit` is now always
respected.
The commit body comes first, then template text. This is for
compatibility with GitHub web interface.

Fixes #1657
This shows commented-out text such as "Creating an issue for github/hub"
not only when `-m` or `-F` weren't passed, but also when they were
passed and `--edit` was used.
@mislav mislav merged commit 9fc6bc8 into master Jan 23, 2018
@mislav mislav deleted the commentchar-auto branch January 23, 2018 17:18
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.

1 participant