AW: [PATCH] git-gui: use commit message template

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
thanks for the info.

I have read the parts of the code required to create the patch, but I do not think I really understand 
the git-gui code, nor tcl/tk.

This change was requested by some of my colleagues, who are used to git-gui and would like to 
continue using it. I personally prefer magit or the shell. This is why I cannot invest more time 
into fixing issues with git.gui, sorry.

However, I tested my change with our commit template, which is basically 30 lines of commented
text. When committing, we uncomment the lines that are relevant for the commit. The commented 
lines were correctly removed in my tests. As I understand it, both cases use the same mechanism,
so I think this is a bug. I cannot make any promises, but I will look into it, should it happen here.

The broken encoding is weird. The patch generated by format-patch is clean utf-8 and looks okay in an 
editor. Maybe it was corrupted somewhere in transfer.

Best Regards

Löwenstein Medical Technology GmbH + Co. KG
i.A. Martin Schön
Entwicklungsingenieur Firmware, F&E Schlaftherapie/Heimbeatmung/PI
Kronsaalsweg 40 ∙ 22525 Hamburg
T: +49 40 54702-126 ∙ F: +49 40 54702-473
Martin.Schoen@xxxxxxxxxxxxxxxxxxxxx ∙ www.loewensteinmedical.de

Geschäftsführung: Benjamin Löwenstein, Sascha Löwenstein ∙ Registergericht: Amtsgericht
Hamburg, Abt. A, Nr. 67 698, USt-IdNr. DE 118051598,  WEEE-Reg.Nr. DE 6339114 ∙ Komplementär: Löwenstein Medical
Technology Verwaltungs GmbH, Hamburg ∙ Registergericht Amtsgericht Hamburg,  Abt. B, Nr. 8678

________________________________________
Von: Stefan Beller <sbeller@xxxxxxxxxx>
Gesendet: Montag, 2. Juli 2018 21:49
An: Schoen, Martin; Pat Thoyts
Cc: git
Betreff: Re: [PATCH] git-gui: use commit message template

+cc Pat, in the hope of an answer.

See
https://public-inbox.org/git/xmqqd0z61xsv.fsf@xxxxxxxxxxxxxxxxxxxxxxxxx/
on the state of git-gui and its lack of maintenance. Maybe Junio will
pickup this patch.

On Mon, Jul 2, 2018 at 11:35 AM Martin Schön
<Martin.Schoen@xxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Use the file described by commit.template (if set) to show the commit message
> template, just like other GUIs.

You seem to have looked at and understood the git-gui code, so
I have a feature request for you if you don't mind:
git-gui takes a commit message as a suggestion from git, for example
after a failed merge, when you open git-gui, it pre-populates the
commit message with

  <previous commit message>

  # Conflict: <file.c>

which git knows how to deal with as '#' is a comment character. However when
using git-gui to compose commit messages, these commented conflicts are not
cut out as git-gui doesn't know how to handle comments?

So it would be awesome if git-gui could either respect '#' as a comment char,
or rather 'core.commentChar'

>
> Signed-off-by: Martin Sch??n <Martin.Schoen@xxxxxxxxxxxxxxxxxxxxx>

The encoding seems to be broken here, as I see '??' in your last name.

> ---
>  git-gui.sh     | 9 +++++++++
>  lib/commit.tcl | 1 +
>  2 files changed, 10 insertions(+)
>
> diff --git a/git-gui.sh b/git-gui.sh
> index 5bc21b8..6fc598d 100755
> --- a/git-gui.sh
> +++ b/git-gui.sh
> @@ -1611,6 +1611,12 @@ proc run_prepare_commit_msg_hook {} {
>                 fconfigure $fd_sm -encoding utf-8
>                 puts -nonewline $fd_pcm [read $fd_sm]
>                 close $fd_sm
> +       } elseif {[file isfile [get_config commit.template]]} {
> +               set pcm_source "template"
> +               set fd_sm [open [get_config commit.template] r]
> +               fconfigure $fd_sm -encoding utf-8
> +               puts -nonewline $fd_pcm [read $fd_sm]
> +               close $fd_sm
>         } else {
>                 set pcm_source ""
>         }
> @@ -1620,6 +1626,9 @@ proc run_prepare_commit_msg_hook {} {
>         set fd_ph [githook_read prepare-commit-msg \
>                         [gitdir PREPARE_COMMIT_MSG] $pcm_source]
>         if {$fd_ph eq {}} {
> +               if {$pcm_source eq "template"} {
> +                       load_message PREPARE_COMMIT_MSG
> +               }
>                 catch {file delete [gitdir PREPARE_COMMIT_MSG]}
>                 return 0;
>         }
> diff --git a/lib/commit.tcl b/lib/commit.tcl
> index 83620b7..168f696 100644
> --- a/lib/commit.tcl
> +++ b/lib/commit.tcl
> @@ -506,6 +506,7 @@ A rescan will be automatically started now.
>         unlock_index
>         reshow_diff
>         ui_status [mc "Created commit %s: %s" [string range $cmt_id 0 7] $subject]
> +       rescan ui_ready
>  }
>
>  proc commit_postcommit_wait {fd_ph cmt_id} {
> --
> 2.17.1
>




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux