# [bug] .git/hooks/commit-msg.sample test is reversed

2 messages from 2015-09-15 to 2015-09-15. Participants: Federico Fissore, Matthieu Moy.
Thread: https://gitlist.dev/t/40356

## Federico Fissore, 2015-09-15 08:43

Subject: [bug] .git/hooks/commit-msg.sample test is reversed
Message-ID: <55F7DA48.30104@fissore.org>
URL: https://gitlist.dev/e/55F7DA48.30104%40fissore.org

```
Hello everyone

In file commit-msg.sample, grep test is reversed. It greps
'^Signed-off-by: '
while it should grep
'Signed-off-by: '

If you run the sample against attached file, it won't complain. Remove 
the ^ and it will work as expected

Regards

Federico


    Commit message
    
    Signed-off-by: Me <me@example.com>
    Signed-off-by: Me <me@example.com>


```

## Matthieu Moy, 2015-09-15 09:10

Subject: Re: [bug] .git/hooks/commit-msg.sample test is reversed
Message-ID: <vpq8u88cajg.fsf@anie.imag.fr>
URL: https://gitlist.dev/e/vpq8u88cajg.fsf%40anie.imag.fr
In-Reply-To: <55F7DA48.30104@fissore.org>

```
Federico Fissore <federico@fissore.org> writes:

> Hello everyone
>
> In file commit-msg.sample, grep test is reversed. It greps
> '^Signed-off-by: '
> while it should grep
> 'Signed-off-by: '
>
> If you run the sample against attached file, it won't complain. Remove
> the ^ and it will work as expected

I think the test is correct.

In grep, ^ can have two meanings:

'^foo' means "foo at the start of a line"
'[^abc]' means "one character but not a, b or c"

The Signed-off-by: trailer is meant to be at the start of a line, hence
the ^.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```
