# Bug: git-describe abbrev documentation mentions wrong default

2 messages from 2018-08-03 to 2018-08-03. Participants: Martin Mosegaard Amdisen, Ævar Arnfjörð Bjarmason.
Thread: https://gitlist.dev/t/49015

## Martin Mosegaard Amdisen, 2018-08-03 11:16

Subject: Bug: git-describe abbrev documentation mentions wrong default
Message-ID: <CAAVPhBmg1=dhGPougT2fXPdA+ogenrS8T3YhbpwzTfurxcn+HA@mail.gmail.com>
URL: https://gitlist.dev/e/CAAVPhBmg1%3DdhGPougT2fXPdA%2BogenrS8T3YhbpwzTfurxcn%2BHA%40mail.gmail.com

```
The documentation for the "git describe --abbrev" flag says that the
default value is 7 hexadecimal digits:
https://github.com/git/git/blob/master/Documentation/git-describe.txt#L63
and
https://git-scm.com/docs/git-describe

I have experienced that sometimes I see 7 digits, but other times more.
The behavior seems to have changed in git 2.11.0 ("default abbreviation
length"):
https://github.com/git/git/blob/aeddbfdfa48443c034a9b28b10dfddf2f71b907f/Documentation/RelNotes/2.11.0.txt

I was able to trigger different behavior using a bash script like the one
below:

ˋˋˋsh
#!/bin/bash

DIR=test-git-describe
rm -rf ${DIR}
mkdir ${DIR}
cd ${DIR}
git init

# One-time test results I have seen:
# 10 tags, 10 * 10 commits: 7 hex digits
# 100 tags, 100 * 100 commits: 8 hex digits
FILE=foo
touch ${FILE}
for i in `seq 1 10`; do
    echo ${i} >> ${FILE}
    git add ${FILE}
    git commit -m "Tag update number ${i} to ${FILE}"
    git tag -m "Version 1.0.${i}" -a 1.0.${i}
    for j in `seq 1 10`; do
        echo ${i}-${j} >> ${FILE}
        git add ${FILE}
        git commit -m "Update number ${i}-${j} to ${FILE}"
    done
done
ˋˋˋ

```

## Ævar Arnfjörð Bjarmason, 2018-08-03 12:20

Subject: Re: Bug: git-describe abbrev documentation mentions wrong default
Message-ID: <87a7q3tze3.fsf@evledraar.gmail.com>
URL: https://gitlist.dev/e/87a7q3tze3.fsf%40evledraar.gmail.com
In-Reply-To: <CAAVPhBmg1=dhGPougT2fXPdA+ogenrS8T3YhbpwzTfurxcn+HA@mail.gmail.com>

```

On Fri, Aug 03 2018, Martin Mosegaard Amdisen wrote:

> The documentation for the "git describe --abbrev" flag says that the
> default value is 7 hexadecimal digits:
> https://github.com/git/git/blob/master/Documentation/git-describe.txt#L63
> and
> https://git-scm.com/docs/git-describe
>
> I have experienced that sometimes I see 7 digits, but other times more.
> The behavior seems to have changed in git 2.11.0 ("default abbreviation
> length"):
> https://github.com/git/git/blob/aeddbfdfa48443c034a9b28b10dfddf2f71b907f/Documentation/RelNotes/2.11.0.txt
>
> I was able to trigger different behavior using a bash script like the one
> below:
>
> ˋˋˋsh
> #!/bin/bash
>
> DIR=test-git-describe
> rm -rf ${DIR}
> mkdir ${DIR}
> cd ${DIR}
> git init
>
> # One-time test results I have seen:
> # 10 tags, 10 * 10 commits: 7 hex digits
> # 100 tags, 100 * 100 commits: 8 hex digits
> FILE=foo
> touch ${FILE}
> for i in `seq 1 10`; do
>     echo ${i} >> ${FILE}
>     git add ${FILE}
>     git commit -m "Tag update number ${i} to ${FILE}"
>     git tag -m "Version 1.0.${i}" -a 1.0.${i}
>     for j in `seq 1 10`; do
>         echo ${i}-${j} >> ${FILE}
>         git add ${FILE}
>         git commit -m "Update number ${i}-${j} to ${FILE}"
>     done
> done
> ˋˋˋ

Yeah this is a documentation bug, and as you note it's describing old
behavior we no longer have. I was on the fence about whether I should
fix this in my WIP 20 patch monster over at
https://public-inbox.org/git/20180608224136.20220-1-avarab@gmail.com/
(which I need to re-roll), but I no longer am, I'll track down these
occurances in the docs and fix them, as I recall there's around 5-10 of
them in various places.

```
