[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: .git/hooks/commit-msg makes git-gui hang
From: |
Jim Meyering |
Subject: |
Re: .git/hooks/commit-msg makes git-gui hang |
Date: |
Wed, 23 Nov 2011 10:06:27 +0100 |
Bernhard Voelker wrote:
> Hi Jim,
>
> I wanted to do a commit in git-gui using a message with
> 74 characters in a line. The commit-msg hook catched that,
> and opened $EDITOR.
>
> However, as I committed from git-gui, there was no
> terminal, and git-gui hang.
>
> berny@blackice:~/git/coreutils> ps -f
> UID PID PPID C STIME TTY TIME CMD
> berny 7183 7181 0 07:59 pts/1 00:00:00 bash
> berny 7909 7183 0 08:07 pts/1 00:00:02 wish /usr/bin/gitk --
> berny 7961 7909 0 08:08 pts/1 00:00:00 git gui
> berny 7962 7961 0 08:08 pts/1 00:00:02 wish /usr/lib/git/git-gui --
> berny 7970 7962 0 08:08 pts/1 00:00:00 aspell --mode=none
> --encoding=utf-8 pipe
> berny 20015 7909 0 09:02 pts/1 00:00:00 git gui
> berny 20016 20015 0 09:02 pts/1 00:00:01 wish /usr/lib/git/git-gui --
> berny 20025 20016 0 09:03 pts/1 00:00:00 aspell --mode=none
> --encoding=utf-8 pipe
> berny 20603 20016 0 09:11 pts/1 00:00:00 perl -w .git/hooks/commit-msg
> .git/GITGUI_EDITMSG
> berny 20605 20603 0 09:11 pts/1 00:00:00 vi .git/GITGUI_EDITMSG
> berny 21037 7183 0 09:17 pts/1 00:00:00 ps -f
>
> Is there an easy solution to avoid using vi when a tty is not
> available? Maybe the commit-msg should start a terminal, or just
> refuse the commit with a diagnostic.
Hi Berny,
Thanks for the report.
I'm not sure it's worth trying to do that.
There are many terminal-only editors.
Besides, using a GUI tool that may invoke another program
that invokes a terminal-requiring EDITOR seems like the real problem.
When using a GUI like git-gui, it seems sensible
to set EDITOR to an editor that does not require a tty.
i.e., invoke it through a function like this:
git-gui() { export EDITOR=vim; git gui "$@"; }