# pre-commit hook and Aspell

3 messages from 2010-07-30 to 2010-07-30. Participants: Stefan Bienert, Junio C Hamano, Jeff King.
Thread: https://gitlist.dev/t/24581

## Stefan Bienert, 2010-07-30 08:51

Subject: pre-commit hook and Aspell
Message-ID: <4C529290.7040509@zbh.uni-hamburg.de>
URL: https://gitlist.dev/e/4C529290.7040509%40zbh.uni-hamburg.de

```
Hi gits,

as instructed by the wiki, I just sent an request to the list without
being subscribed...

I'm trying to setup a hook for my project which forces me to check the
spelling of text (here: TeX) files, whenever they change. As
spellchecker I use Aspell, which is giving me a headache at the moment.
The problem is: Running the pre-commit script in the shell works,
started as hook does not.

Here is my script (cut down to a minimalist version resembling the problem):

# SNIP
#!/bin/sh

for my_p in $(git status --porcelain | awk '{ if ($0 ~ /\.(tex|sty)$/) {
print $2 } }')
do
    aspell -c -l en_GB -p $(pwd)/${my_cdup}share/dict/aspell.corb.pws
$my_p || exit 1
done
# SNAP

regards,

Stefan

-- 
Stefan Bienert
Zentrum fuer Bioinformatik
Universitaet Hamburg
Bundesstrasse 43
20146 Hamburg
Germany

Email: bienert@zbh.uni-hamburg.de
Phone:  +49 (40) 42838 7345
Fax:    +49 (40) 42838 7332

```

## Junio C Hamano, 2010-07-30 15:59

Subject: Re: pre-commit hook and Aspell
Message-ID: <7vd3u5rme0.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vd3u5rme0.fsf%40alter.siamese.dyndns.org
In-Reply-To: <4C529290.7040509@zbh.uni-hamburg.de>

```
Stefan Bienert <bienert@zbh.uni-hamburg.de> writes:

> Here is my script (cut down to a minimalist version resembling the problem):
>
> # SNIP
> #!/bin/sh
>
> for my_p in $(git status --porcelain | awk '{ if ($0 ~ /\.(tex|sty)$/) {
> print $2 } }')

A tangent; perhaps "git status --porcelain '*.tex' '*.sty'" would help you
lose the pipe and awk.

> do
>     aspell -c -l en_GB -p $(pwd)/${my_cdup}share/dict/aspell.corb.pws
> $my_p || exit 1

Not quite sure what my-cdup is here, but probably you would want to have
something like this at the top of the script?

	#!/bin/sh
	"cd .."

```

## Jeff King, 2010-07-30 18:21

Subject: Re: pre-commit hook and Aspell
Message-ID: <20100730182116.GA18544@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20100730182116.GA18544%40coredump.intra.peff.net
In-Reply-To: <4C529290.7040509@zbh.uni-hamburg.de>

```
On Fri, Jul 30, 2010 at 10:51:28AM +0200, Stefan Bienert wrote:

> I'm trying to setup a hook for my project which forces me to check the
> spelling of text (here: TeX) files, whenever they change. As
> spellchecker I use Aspell, which is giving me a headache at the moment.
> The problem is: Running the pre-commit script in the shell works,
> started as hook does not.

Hooks run without stdio connected to the tty. Have you tried doing
"aspell </dev/tty >/dev/tty" in your hook?

-Peff

```
