Bug 553065 - Stripping comment lines from commit messages
Summary: Stripping comment lines from commit messages
Status: RESOLVED FIXED
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 6.1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 395001 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-11-14 11:22 EST by Thomas Wolf CLA
Modified: 2022-01-31 17:06 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wolf CLA 2019-11-14 11:22:04 EST
EGit does that on Squash (using #, not core.commentChar), but otherwise it just passes on all lines to JGit. JGit also doesn't remove comment lines.

EGit should do so, otherwise one invariable includes the "Conflicting..." lines in the commit message after having resolved merge conflicts.

Doing this unconditionally may be a disruptive departure from current behavior, though. I'm unsure how this would best be done. Preference? Warning in the staging view if the commit message has lines starting with the comment character, with a link/button to remove them? Or pop-up dialog asking the user?

See also Lakshmi's EclipseCon2019 demo @20:21,[1] where she also ended up with a commit message including these conflict lines. Also see bug 548529.

[1] https://www.youtube.com/watch?v=D73L9YlBlP8&list=PLy7t4z5SYNaT_yo5Dhajb9i-Pf0LbQ3z8&index=118&t=1221s
Comment 1 Matthias Sohn CLA 2019-11-14 12:49:47 EST
I think that's a bug in JGit which should be fixed there.
I don't care if this departs from current behaviour which clearly breaks behaviour by native git.
Comment 2 Thomas Wolf CLA 2019-11-14 14:32:06 EST
(In reply to Matthias Sohn from comment #1)
> I think that's a bug in JGit which should be fixed there.
> I don't care if this departs from current behaviour which clearly breaks
> behaviour by native git.

Might changing it in JGit not affect current JGit clients? And if done in JGit, should be done honoring core.commentChar. (Maybe minus the 'auto' setting?)

There's also bug 513726. (Fixup in interactive rebase strips, but shouldn't.) Haven't checked whether that's a bug in JGit or in EGit.
Comment 3 Matthias Sohn CLA 2020-01-05 15:57:03 EST
*** Bug 395001 has been marked as a duplicate of this bug. ***
Comment 4 Matthias Sohn CLA 2020-01-06 09:14:29 EST
Also see commit command option --cleanup [1] and core.commentChar value "auto" [2].

[1] https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---cleanupltmodegt
[2] https://git-scm.com/docs/git-config#Documentation/git-config.txt-corecommentChar
Comment 5 Eclipse Genie CLA 2022-01-17 18:29:13 EST
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/189723
Comment 6 Eclipse Genie CLA 2022-01-17 18:29:15 EST
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/189724