# git log with %(describe) placeholder does not find most recent tag

5 messages from 2021-10-11 to 2021-10-11. Participants: Benjamin Kircher, Bagas Sanjaya, Carlo Arenas, Jeff King.
Thread: https://gitlist.dev/t/56680

## Benjamin Kircher, 2021-10-11 08:08

Subject: git log with %(describe) placeholder does not find most recent tag
Message-ID: <61d28b8e9dd906eba821ecc9ee81bd4ac2374494.camel@0xadd.de>
URL: https://gitlist.dev/e/61d28b8e9dd906eba821ecc9ee81bd4ac2374494.camel%400xadd.de

```
Hello there,


What did you do before the bug happened? (Steps to reproduce your
issue)

    git log --format='%(describe)' -n1

produces a different result than

    git describe --tags

What did you expect to happen? (Expected behavior)

I expected both to produce (roughly) the same result. At least,
reference the same tag.

What happened instead? (Actual behavior)

    git log --format='%(describe)' -n1
    v0.11.0

and

    git log --format='%(describe)' -n1
    v0.3.0-beta-253-g4ccd023

What's different between what you expected and what actually happened?

git log with %(describe) placeholder does not seem to find the most
recent tag as git-describe would do. Is this intended?


[System Info]
git version:
git version 2.33.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 5.14.10-200.fc34.x86_64 #1 SMP Thu Oct 7 20:49:53 UTC 2021
x86_64
compiler info: gnuc: 11.2
libc info: glibc: 2.33
$SHELL (typically, interactive shell): /bin/zsh


[Enabled Hooks]



```

## Bagas Sanjaya, 2021-10-11 08:23

Subject: Re: git log with %(describe) placeholder does not find most recent tag
Message-ID: <732e64ad-0ca0-d384-a09b-55c74479e254@gmail.com>
URL: https://gitlist.dev/e/732e64ad-0ca0-d384-a09b-55c74479e254%40gmail.com
In-Reply-To: <61d28b8e9dd906eba821ecc9ee81bd4ac2374494.camel@0xadd.de>

```
On 11/10/21 15.08, Benjamin Kircher wrote:
> What did you do before the bug happened? (Steps to reproduce your
> issue)
> 
>      git log --format='%(describe)' -n1
> 
> produces a different result than
> 
>      git describe --tags
> 
> What did you expect to happen? (Expected behavior)
> 
> I expected both to produce (roughly) the same result. At least,
> reference the same tag.
> 
> What happened instead? (Actual behavior)
> 
>      git log --format='%(describe)' -n1
>      v0.11.0
> 
> and
> 
>      git log --format='%(describe)' -n1
>      v0.3.0-beta-253-g4ccd023
> 
> What's different between what you expected and what actually happened?
> 
> git log with %(describe) placeholder does not seem to find the most
> recent tag as git-describe would do. Is this intended?

I tried to reproduce your issue. I have linux.git shallow repo (master 
branch pulls from torvalds' mainline tree and stable branches pull from 
stable tree). HEAD currently points to v5.15-rc5 tag.

The result (note that I use custom-compiled Git):

ˋˋˋ
$ /opt/git/bin/git version
git version 2.33.0

$ /opt/git/bin/git log -n 1 --format='%(describe)'
v5.15-rc5

$ /opt/git/bin/git describe --tags
v5.15-rc5
ˋˋˋ

Both results (git log and git describe) are same.

-- 
An old man doll... just what I always wanted! - Clara

```

## Benjamin Kircher, 2021-10-11 08:29

Subject: Re: git log with %(describe) placeholder does not find most recent tag
Message-ID: <39ac5fe17bdf0f486cb8ffd4b8dec6d60acc9244.camel@0xadd.de>
URL: https://gitlist.dev/e/39ac5fe17bdf0f486cb8ffd4b8dec6d60acc9244.camel%400xadd.de
In-Reply-To: <732e64ad-0ca0-d384-a09b-55c74479e254@gmail.com>

```
On Mon, 2021-10-11 at 15:23 +0700, Bagas Sanjaya wrote:
> Both results (git log and git describe) are same.

Yes. Good one. Absolutely correct. I wasn't able to reproduce that with
Linux repository, too.

Problem is observed only in some repositories while others seem fine.

I was able to reproduce it with a freshly cloned version of:

  https://github.com/gridscale/gscloud.git

BK



```

## Carlo Arenas, 2021-10-11 12:27

Subject: Re: git log with %(describe) placeholder does not find most recent tag
Message-ID: <CAPUEsphLXcCw=Qj1Rw5ONf2GduQAs62VwkVd3gTt4=PLaGkBcg@mail.gmail.com>
URL: https://gitlist.dev/e/CAPUEsphLXcCw%3DQj1Rw5ONf2GduQAs62VwkVd3gTt4%3DPLaGkBcg%40mail.gmail.com
In-Reply-To: <61d28b8e9dd906eba821ecc9ee81bd4ac2374494.camel@0xadd.de>

```
On Mon, Oct 11, 2021 at 1:10 AM Benjamin Kircher <bkircher@0xadd.de> wrote:
> produces a different result than
>
>     git describe --tags

if the repository you are looking at has non annotated tags (the ones
that have no signature or message and that are created by default with
`git tag`), then that is expected and explained in the documentation
for the '--tags' option you are using.

Carlo

```

## Jeff King, 2021-10-11 16:23

Subject: Re: git log with %(describe) placeholder does not find most recent tag
Message-ID: <YWRlBLu+st02X7MD@coredump.intra.peff.net>
URL: https://gitlist.dev/e/YWRlBLu%2Bst02X7MD%40coredump.intra.peff.net
In-Reply-To: <CAPUEsphLXcCw=Qj1Rw5ONf2GduQAs62VwkVd3gTt4=PLaGkBcg@mail.gmail.com>

```
On Mon, Oct 11, 2021 at 05:27:39AM -0700, Carlo Arenas wrote:

> On Mon, Oct 11, 2021 at 1:10 AM Benjamin Kircher <bkircher@0xadd.de> wrote:
> > produces a different result than
> >
> >     git describe --tags
> 
> if the repository you are looking at has non annotated tags (the ones
> that have no signature or message and that are created by default with
> `git tag`), then that is expected and explained in the documentation
> for the '--tags' option you are using.

Yes, that's the case in the example repo he showed. I don't think there
is currently a way to convince %(describe) to use "--tags" in the
underlying describe command, but it seems like a reasonable extension if
somebody is interested in writing it. We already take some options to
%(describe), so the syntax is prepared to add more.

-Peff

```
