git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Possible bug in git describe, additional commits differs when cloned with --depth

From
AJAnders Janmyr <anders@janmyr.com>
Date
Sep 27, 2019, 09:51 UTC
Message-ID
<CA+UvoT7EBa6S6Fi7scYTo8mYKx=n1e=sPvxy5TRP3vG7gw97Xw@mail.gmail.com>
Hi,

I'm not sure if this is a bug or not but `git describe` gives different results when the repo has been cloned with `--depth` or not.

In the example below from the git repository the number of additional commits since the last tag differs 256 vs. 265.

``` $ git clone https://github.com/git/git $ cd git/ $ git describe v2.23.0-256-g4c86140027 $ git rev-list -n 1 HEAD 4c86140027f4a0d2caaa3ab4bd8bfc5ce3c11c8a

$ git clone --depth=50 https://github.com/git/git git-depth $ cd git-depth/ $ git describe v2.23.0-265-g4c861400 $ git rev-list -n 1 HEAD 4c86140027f4a0d2caaa3ab4bd8bfc5ce3c11c8a ```

In the example above the first version also gives additional digits for the SHA, g4c86140027 vs. g4c861400, but that is not always the case.

I came upon this discrepancy when using the value from `git describe` in a build pipeline where the system optimized the build by cloning the repo using `--depth`.

Kind regards -- http://anders.janmyr.com/ @andersjanmyr +46 733-99 03 60

Next: SZEDER Gábor
Message 1 of 3 in “Possible bug in git describe, additional commits differs when cloned with --depth”
  1. Anders JanmyrSep 27, 2019
  2. SZEDER GáborSep 27, 2019
  3. [BUG] a commit date-related bug in 'git describe' [was: Re: Possible bug in git describe, additional commits differs when cloned with --depth]SZEDER Gábor, Oct 8, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.