git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Anders Janmyr <anders@janmyr.com>
To: git@vger.kernel.org
Subject: Possible bug in git describe, additional commits differs when cloned with --depth
Date: Fri, 27 Sep 2019 11:51:07 +0200	[thread overview]
Message-ID: <CA+UvoT7EBa6S6Fi7scYTo8mYKx=n1e=sPvxy5TRP3vG7gw97Xw@mail.gmail.com> (raw)

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

             reply	other threads:[~2019-09-27  9:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-27  9:51 Anders Janmyr [this message]
2019-09-27 12:02 ` Possible bug in git describe, additional commits differs when cloned with --depth SZEDER Gábor
2019-10-08 12:31   ` [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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+UvoT7EBa6S6Fi7scYTo8mYKx=n1e=sPvxy5TRP3vG7gw97Xw@mail.gmail.com' \
    --to=anders@janmyr.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).