Subject: Re: bug#63775: git describe on current master says: v1.3.0-38775-g6192acf8b7

From: Simon Tournier <[email-masked]>
Date: Tue, 30 May 2023 17:25:01 +0200

Hi,

On dim., 28 mai 2023 at 17:16, Janneke Nieuwenhuizen <[email-masked]> wrote:

> --8<---------------cut here---------------start------------->8---
> 17:12:25 janneke@drakenpad:~/src/guix/master [env]
> $ git fetch origin
> 17:12:56 janneke@drakenpad:~/src/guix/master [env]
> $ git fetch origin --tags
> 17:13:04 janneke@drakenpad:~/src/guix/master [env]
> $ git reset --hard origin/master
> HEAD is now at 6192acf8b7 gnu: telegram-desktop: Update to 4.8.1
> 17:13:09 janneke@drakenpad:~/src/guix/master [env]
> $ git describe
> v1.3.0-38775-g6192acf8b7
> --8<---------------cut here---------------end--------------->8---

Oh, that’s weird!

--8<---------------cut here---------------start------------->8---
$ git describe --debug
describe HEAD
No exact match on refs or tags, searching to describe
 annotated      38817 v1.3.0
 annotated      38831 v1.3.0rc2
 annotated      38870 v1.3.0rc1
 annotated      55660 base-for-issue-62196
 annotated      55806 v1.2.0
 annotated      55814 v1.2.0rc2
 annotated      55837 v1.2.0rc1
 annotated      55985 v1.4.0
 annotated      55998 v1.4.0rc2
 annotated      56031 v1.4.0rc1
traversed 56356 commits
more than 10 tags found; listed 10 most recent
gave up search at d62c9b2671be55ae0305bebfda17b595f33797f2
v1.3.0-38817-g76b7bc5392

$ git rev-list --count v1.3.0..HEAD
38817
--8<---------------cut here---------------end--------------->8---

The manual reads,

        SEARCH STRATEGY

        [...]

             If an exact match was not found, git describe will walk back
             through the commit history to locate an ancestor commit
             which has been tagged. The ancestor’s tag will be output
             along with an abbreviation of the input commit-ish’s
             SHA-1. If --first-parent was specified then the walk will
             only consider the first parent of each commit.

             If multiple tags were found during the walk then the tag
             which has the fewest commits different from the input
             commit-ish will be selected and output. Here fewest commits
             different is defined as the number of commits which would be
             shown by git log tag..input will be the smallest number of
             commits possible.

And then,

--8<---------------cut here---------------start------------->8---
$ git rev-list --count v1.4.0..HEAD
9980
--8<---------------cut here---------------end--------------->8---

Hum, why does “git describe” count 55985?  Well, it’s weird, for
instance, using my repository, the DAG looks like:

--8<---------------cut here---------------start------------->8---
$ git --no-pager log --all --graph --simplify-by-decoration --format="%h %d"
* 76b7bc5392  (HEAD -> master)
* 2b1b0a580d  (origin/master, origin/HEAD)
| * ecb19e3353  (origin/tex-team-next)
| * bb07562a89  (origin/tex-team)
|/  

[...]

* 45fd01ac5d  (tag: base-for-issue-62196)

[...]

| * d8abcffda5  (origin/wip-guile-ssh-0.16)
|/  
| * e81a75a7b2  (origin/wip-r)
|/  
* 989a3916dc  (origin/version-1.4.0)
* 8e2f32cee9  (tag: v1.4.0)  
* 7866294e32  (tag: v1.4.0rc2)
* 020184fd39  (tag: v1.4.0rc1)
| * 7966084069  (origin/wip-aarch64-bootstrap)

[...]

| * 8d84a9ee71  (origin/version-1.2.0)
| | * aa34d4d28d  (origin/version-1.3.0)
| |/  
|/|   
| | * 592101268f  (origin/wip-ppc)
| |/  
|/|   
* | a0178d34f5  (tag: v1.3.0)
* | 7a65beff0f  (tag: v1.3.0rc2)
* | 0d353b06ec  (tag: v1.3.0rc1)
|/  
| * fafad6b17c  (origin/wip-node-importer)
--8<---------------cut here---------------end--------------->8---

Therefore, I would be expecting that the tag ’base-for-issue-62196’
would be the output of “git describe”.

> (There was a question on IRC by cassio: "How do I upgrade to 1.4",
>  but I don't see it in the channel logs yet).

Well, about upgrading to 1.4, it depends from which Guix revision. :-)

Something like,

    guix pull --commit=8e2f32cee982d42a79e53fc1e9aa7b8ff0514714

should do the job.  And if not, the answer will depend on the current
Guix revision which requires an update.

Cheers,
simon