# Bizarre behavior on git commit

6 messages from 2010-05-05 to 2010-05-06. Participants: Dan Loewenherz, Jonathan Nieder, Matthieu Moy, Chris Packham.
Thread: https://gitlist.dev/t/23702

## Dan Loewenherz, 2010-05-05 05:46

Subject: Bizarre behavior on git commit
Message-ID: <s2t6f5a4e781005042246sb9ef3d48j134b22b5b41133ed@mail.gmail.com>
URL: https://gitlist.dev/e/s2t6f5a4e781005042246sb9ef3d48j134b22b5b41133ed%40mail.gmail.com

```
I'm running into a weird issue in a specific repo where "git show-ref"
usage is being displayed after invocating "git commit".

E.g.
$ git commit -m "my commit message"
usage: git show-ref [-q|--quiet] [--verify] [--head]
[-d|--dereference] [-s|--hash[=<n>]] [--abbrev[=<n>]] [--tags]
[--heads] [--] [pattern*]
   or: git show-ref --exclude-existing[=pattern] < ref-list

    --tags                only show tags (can be combined with heads)
    --heads               only show heads (can be combined with tags)
    --verify              stricter reference checking, requires exact ref path
    --head                show the HEAD reference
    -d, --dereference     dereference tags into object IDs
    -s, --hash[=<n>]      only show SHA1 hash using <n> digits
    --abbrev[=<n>]        use <n> digits to display SHA-1s
    -q, --quiet           be quiet
    --exclude-existing[=<pattern>]
                          show refs from stdin that aren't in local repository

[master 28a735f] my commit message
 1 files changed, 2 insertions(+), 0 deletions(-)
$

This happens for every commit in this repository. I looked through the
git source and failed to find any reference to git show-ref (or
anything related to it) in buildin/commit.c. I gave up my search in
hope that someone on the git list would have a better idea. I'm
running version 1.7.0.3.311.g6a6955.

-Dan

```

## Jonathan Nieder, 2010-05-05 06:01

Subject: Re: Bizarre behavior on git commit
Message-ID: <20100505060110.GA21260@progeny.tock>
URL: https://gitlist.dev/e/20100505060110.GA21260%40progeny.tock
In-Reply-To: <s2t6f5a4e781005042246sb9ef3d48j134b22b5b41133ed@mail.gmail.com>

```
Dan Loewenherz wrote:

> I'm running into a weird issue in a specific repo where "git show-ref"
> usage is being displayed after invocating "git commit".
> 
> E.g.
> $ git commit -m "my commit message"
> usage: git show-ref [-q|--quiet] [--verify] [--head]
[...]
>                           show refs from stdin that aren't in local repository
> 
> [master 28a735f] my commit message
>  1 files changed, 2 insertions(+), 0 deletions(-)
> $

Strange.  Maybe a hook script?

  GIT_TRACE=1 git commit -m "my commit message"

should reveal the culprit, I hope.

Hope that helps,
Jonathan

```

## Matthieu Moy, 2010-05-05 10:06

Subject: Re: Bizarre behavior on git commit
Message-ID: <vpqd3xa4q7z.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqd3xa4q7z.fsf%40bauges.imag.fr
In-Reply-To: <20100505060110.GA21260@progeny.tock>

```
Jonathan Nieder <jrnieder@gmail.com> writes:

> Strange.  Maybe a hook script?
>
>   GIT_TRACE=1 git commit -m "my commit message"
>
> should reveal the culprit, I hope.

If it doesn't, playing with "strace" may help (like:
strace -f -e clone,execve git commit -m foobar ).

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

```

## Chris Packham, 2010-05-05 16:52

Subject: Re: Bizarre behavior on git commit
Message-ID: <t2ga038bef51005050952u3370cf68pa45496e56a4adb7b@mail.gmail.com>
URL: https://gitlist.dev/e/t2ga038bef51005050952u3370cf68pa45496e56a4adb7b%40mail.gmail.com
In-Reply-To: <s2t6f5a4e781005042246sb9ef3d48j134b22b5b41133ed@mail.gmail.com>

```
Hi,

On Tue, May 4, 2010 at 10:46 PM, Dan Loewenherz <dloewenherz@gmail.com> wrote:
> I'm running into a weird issue in a specific repo where "git show-ref"
> usage is being displayed after invocating "git commit".
>
> E.g.
> $ git commit -m "my commit message"
> usage: git show-ref [-q|--quiet] [--verify] [--head]
> ...

This may or may not be the case for you but I did have a bit of a
face-palm issue a while back because I was tinkering with a __git_ps1
bash script and forgot. I was actually getting output from one git
command or another and couldn't figure out why until I eventually
figured out that the commands that were complaining were used in my
__git_ps1 script. This was mainly when I was doing slightly unexpected
things (at least as far as __git_ps1 was concerned, e.g during an
interactive rebase ).

Its probably not your problem but just double check with 'echo "$PS1"'
from your shell.

```

## Dan Loewenherz, 2010-05-06 03:32

Subject: Re: Bizarre behavior on git commit
Message-ID: <n2m6f5a4e781005052032sf47733ebwf490e0369bebd03f@mail.gmail.com>
URL: https://gitlist.dev/e/n2m6f5a4e781005052032sf47733ebwf490e0369bebd03f%40mail.gmail.com
In-Reply-To: <20100505060110.GA21260@progeny.tock>

```
On Tue, May 4, 2010 at 11:01 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Dan Loewenherz wrote:
>
>> I'm running into a weird issue in a specific repo where "git show-ref"
>> usage is being displayed after invocating "git commit".
>>
>> E.g.
>> $ git commit -m "my commit message"
>> usage: git show-ref [-q|--quiet] [--verify] [--head]
> [...]
>>                           show refs from stdin that aren't in local repository
>>
>> [master 28a735f] my commit message
>>  1 files changed, 2 insertions(+), 0 deletions(-)
>> $
>
> Strange.  Maybe a hook script?

The GIT_TRACE helped--it was a hook script. The script's been in my
local repo for quite a while, strange that it only started having this
behavior recently. Removed the script and all works normally.

Thanks for the suggestion!

-Dan

```

## Jonathan Nieder, 2010-05-06 04:57

Subject: Re: Bizarre behavior on git commit
Message-ID: <20100506045726.GA27055@progeny.tock>
URL: https://gitlist.dev/e/20100506045726.GA27055%40progeny.tock
In-Reply-To: <n2m6f5a4e781005052032sf47733ebwf490e0369bebd03f@mail.gmail.com>

```
Dan Loewenherz wrote:
>> Dan Loewenherz wrote:

>>> $ git commit -m "my commit message"
>>> usage: git show-ref [-q|--quiet] [--verify] [--head]
[...]
> The GIT_TRACE helped--it was a hook script. The script's been in my
> local repo for quite a while, strange that it only started having this
> behavior recently.

My bad.

$ git show -s v1.6.6-rc0~34^2~17
[...]
    Does anybody use "show-ref -h"?  It was in Linus's original, most
    likely only because "it might be handy", not because "the command
    should not show the HEAD by default for such and such reasons".
    So I think it is okay if "show-ref -h" (but not "show-ref
    --head") gives help and exits.
    
    If a current script uses "git show-ref -h" without any other
    arguments, it would have to be adapted by changing "-h" to
    "--head".
    
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>

I was too dense to notice the connection until just now.

> Removed the script and all works normally.

If you still have the script, I would be happy to look it over, for
curiosity’s sake.

Cheers,
Jonathan

```
