git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Beller <sbeller@google.com>
To: Martin.Schoen@loewensteinmedical.de,
	Pat Thoyts <patthoyts@users.sourceforge.net>
Cc: git <git@vger.kernel.org>
Subject: Re: [PATCH] git-gui: use commit message template
Date: Mon, 2 Jul 2018 12:49:35 -0700	[thread overview]
Message-ID: <CAGZ79kbwbUSYDKVfxFyYX6LUW6xgBd7dSPethwP9w5Zz4ritdQ@mail.gmail.com> (raw)
In-Reply-To: <20180702182521.EC55341BAC@mail.steuer-voss.de>

+cc Pat, in the hope of an answer.

See
https://public-inbox.org/git/xmqqd0z61xsv.fsf@gitster-ct.c.googlers.com/
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@loewensteinmedical.de> 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@loewensteinmedical.de>

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
>

  reply	other threads:[~2018-07-02 19:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-02 13:28 [PATCH] git-gui: use commit message template Martin Schön
2018-07-02 19:49 ` Stefan Beller [this message]
2018-07-03  8:53   ` AW: " Schoen, Martin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGZ79kbwbUSYDKVfxFyYX6LUW6xgBd7dSPethwP9w5Zz4ritdQ@mail.gmail.com \
    --to=sbeller@google.com \
    --cc=Martin.Schoen@loewensteinmedical.de \
    --cc=git@vger.kernel.org \
    --cc=patthoyts@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).