prati0100 / git-gui

Tcl/Tk based UI for Git. I am currently acting as the project's maintainer.
160 stars 87 forks source link

git-gui doesn't cleanup commit message (strip comments and blank lines) like git-commit #65

Open r0nw opened 2 years ago

r0nw commented 2 years ago

Git GUI does not cleanup commit message after editing, which is especially a problem when using commit templates, or in some other cases e.g. after merging when comments appear in the commit message.

I see this issue was actually fixed in Feb 2021 (commit b9a43869c9f96d3577d6f568c1bda1940c8f0e31) but then reverted straight away in March (commit c0698df0579a14270e491b2f1ffdfc39d3b86310).

Do you plan to do the fix again, please?

Btw, executing git -c core.editor=true commit --amend --edit could be used to "post process" just created commit and cleanup it's message. If you'd be willing to accept such solution, I can send it as a patch to the mailinglist. It's very simple, but maybe does not really fit well into git-gui source which only seems to use lower level git plumbing commands.

Thanks.

prati0100 commented 2 years ago

Do you plan to do the fix again, please?

Yes. Eric sent a patch which would work with older versions of Tcl. I didn't get around to looking into it back then. But it looks good to me so I will apply it.

Btw, executing git -c core.editor=true commit --amend --edit could be used to "post process" just created commit and cleanup it's message. If you'd be willing to accept such solution, I can send it as a patch to the mailinglist. It's very simple, but maybe does not really fit well into git-gui source which only seems to use lower level git plumbing commands.

Yes, we don't want to use porcelain commands since their interface is not guaranteed to be stable.

r0nw commented 2 years ago

Yes. Eric sent a patch... it looks good to me so I will apply it.

That's great news, thank you.

Yes, we don't want to use porcelain commands since their interface is not guaranteed to be stable.

That's what I expected. Unfortunately it means you are reimplementing a lot of functionality which is already implemented in those porcelain commands. Looks to me like using them the git-gui code could be really much simpler/shorter, not to mention avoiding undesired differences/inconsistencies with command line git.