neomutt / neomutt

✉️ Teaching an Old Dog New Tricks -- IRC: #neomutt on irc.libera.chat
https://neomutt.org/
GNU General Public License v2.0
3.26k stars 308 forks source link

No git tag for release? #4238

Closed nobrowser closed 7 months ago

nobrowser commented 7 months ago

The current release (2024-03-29, according to the website) seems to lack a corresponding git tag.

All the best,

-- Ian

flatcap commented 7 months ago

er... It's definitely there

$ git push github --tags
Everything up-to-date

But... If you just git log from main you might not see it, as it's on a branch.

main
...
|
| * 11482a5f7 NeoMutt 2024-03-29 (tag: 20240329)
| * 9723081ee notmuch: strip leading / from short path
| * 4f0a6eee8 status: reset Buffer before reuse
| * 4015b1b95 mutt_file_fopen: drop O_TRUNC
| * d8b2823ef mbox: fix sorting for mbox_resync()
| * d5306e652 history: truncate file before writing over it
|/  
* 92c28be22 NeoMutt 2024-03-23 (tag: 20240323)
* 3baa822e5 wrap colour in <show-log-messages>
* de288a56d match folder-hook also against mailbox name (fixes #4201)
* e6a5746c7 build: use codeql v3
nobrowser commented 7 months ago

Up on github, doesn't seem to be on any branch, in fact -- it has been left behind. When I click on the commit ID, I get a scary yellow warning message (yes, I'm afraid of chickens :)

Which explains why a "git fetch" doesn't download it.

Looks like github and your personal repo have gone out of sync, or maybe there another central repo that's a real source of truth, but in that case I don't know about it.

Update: I was able to work around with git fetch 11482a5 ; git checkout 11482a5 . But I still think this state is not what you / we want.

Best, -- Ian

roccoblues commented 7 months ago

Sorry for closing this too soon. I've checked now and also can't find the tag locally.

My log:

~/projects/neomutt main
❯ g checkout 11482a5
error: pathspec '11482a5' did not match any file(s) known to git

~/projects/neomutt main
❯ g checkout 20240329
error: pathspec '20240329' did not match any file(s) known to git

~/projects/neomutt main
❯ g remote -v show
origin  https://github.com/neomutt/neomutt.git (fetch)
origin  https://github.com/neomutt/neomutt.git (push)

~/projects/neomutt main
❯ g fetch origin 11482a5
fatal: couldn't find remote ref 11482a5

~/projects/neomutt main
❯ g fetch origin 20240329
remote: Enumerating objects: 16, done.
remote: Counting objects: 100% (9/9), done.
remote: Total 16 (delta 9), reused 9 (delta 9), pack-reused 7
Unpacking objects: 100% (16/16), 3.97 KiB | 406.00 KiB/s, done.
From https://github.com/neomutt/neomutt
 * tag                   20240329   -> FETCH_HEAD

~/projects/neomutt main
❯ g show 20240329
fatal: ambiguous argument '20240329': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

~/projects/neomutt main
❯ g show 11482a5
commit 11482a5f7881755c421547fb3a44276b8d758f0f
Author: Richard Russon (@flatcap) <rich@flatcap.org>
Date:   Fri Mar 29 14:27:35 2024 +0000

    NeoMutt 2024-03-29

@nobrowser

git fetch 11482a5

I wonder how this worked. Aren't you supposed to specify the repository?

flatcap commented 7 months ago

OK, now I understand. The repo and tags are correct. Your confusion is my fault. Sorry :-)

I used the word "branch" when I shouldn't have. The release is in a separate "spur" that's only referenced by the release tag.

tl;dr GitHub will keep track of the commits for Release 20240329 because there's a tag pointing to it.


git keeps track of commits in three ways:


When I made Release 20240329 I did so from a local branch. This branch was rooted on the previous, broken, release. The branch contained a handful of fixes. (I had already committed some big changes to main, so I didn't want to release that)

I signed the release commit and created a signed tag pointing to it. Then, I pushed the tag to GitHub and made the release. I deleted my local branch as it was now unneeded.

GitHub has a tag pointing to release commit: 11482a5f7881755c421547fb3a44276b8d758f0f

GitHub's warning is that there isn't a branch pointing to that commit.

As the tag is a signed tag, it's also a permanent git object. imho, the warning is bogus.


Now, everyone can get the changes:

$ git fetch --tags
From https://github.com/neomutt/neomutt
 * [new tag]             20240329   -> 20240329

(or git fetch origin --tags if you have multiple "remotes")

You can verify the details:

Tag: git cat-file -p 20240329 ``` object 11482a5f7881755c421547fb3a44276b8d758f0f type commit tag 20240329 tagger Richard Russon 1711722494 +0000 NeoMutt release 2024-03-29 -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEhsI5cnDdelYSY8pOX68Kbuc3GAUFAmYGz/4ACgkQX68Kbuc3 GAVNnxAAiPYSCJBvoB4er3EC5d66Bpf6sxb9XIBOMAMjE7s09/2y+/+YJ1NQ5Oo6 kTIrZV0KEBkT+D/aq+XV1F0eCmmDIhqeqGi8ooXqGOGyO6Ti9MV55AcNfydEeTrt V5Q1oNsxUD4pehXtt1ovSHor7UJQa742CqFlhyT4aSkTy3heqOiJQnv6cBi04C7E xNr3O7Jh+uHRAE26pVDqc90PG+7ZwxY/cmop+fbTorzl75v6xzwBXJ02LKNj0kkM 7F6rsT7G1OoZhYBmy27v3xoQJgIXlZCeIlCWbdTb018f3mh/H4TZriDJY26n1KGL 8wSIOfmazo5fMpzfUVNgkbU6Jxt4uqXMQMSVie12yYDovbNVqf+luUsGfYkebdHZ njrRTRiGcrp9BsA/9U4+ZIyUaIRor6XD5O+J5jTzyzdLyS3MMIpX3Eet0GLCy5MK MZE5XpKN7EPPIc9VQiEsEJnPo/f7pXjyvGlIhp1A7jFVzdudTEYVHyp4JtFA2ZXf dhvdsbQ8iYp9lTRdBHbxJgtusgBFLNm5Wt5NrmJiaqf5aPBChFNFoBIvso9jw96g q6rRBX5GanlGpO3pQzNQbxsYD4jfGvoN5x8aOcmq2m0S5PGG+OnkgCm+300FPniR VXAkJ0xPPXVr3CzcQMUpsj0rR1MQqCGrwk+QnyfBKUjXxOZOIYI= =u3da -----END PGP SIGNATURE----- ```

Which links to object 11482a5f7881755c421547fb3a44276b8d758f0f

Release: git cat-file -p 11482a5f7881755c421547fb3a44276b8d758f0f ``` tree 283f4e9aa151c6aab8af5c8b2f12afbfa8fa27e1 parent 9723081ee5ff83848d8efd1b47efbecddc4f6a1d author Richard Russon 1711722455 +0000 committer Richard Russon 1711722455 +0000 gpgsig -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEhsI5cnDdelYSY8pOX68Kbuc3GAUFAmYGz9cACgkQX68Kbuc3 GAWSbw//YHn7U1317WvA28wSKlG+EzWrreLp1qqfcD4d6waDLYFNjAkgG1BBDr7Y NbOcASOoNGevcvKDsZQ+LWHJGWjtKoiPqvKqNAGpQzTJem6M0B7Hwini9xjT/ULp PXWKNkqIbPcotPYr5DpmtIG1x0g8GVyowJenCaJMLZgqOQ8J/UjtRXNMqxzOF2mE 64w+/aXPp/q4wyJA2DhDuVCWzMJlAy9AuK1qCkKk0G/S1VB3CTKfvcH/jWe0Bk8T 5iLD2+xYF60xsSy6AyK89AdDypnq9QQ30Lcrob1TZX5MgFuc6pzuLFDyyPiPZ27Z k7w6R1pcXdP9YIFwHG9exQee4Ojf/JcmLevYfopV9Xkj7aBFU9iXpqQurRDvkS/D My20tS717IQitwyEVIy4Y9y63Uv+fhuSWMZSgXD9UO3Tsj1YarPLL+9QYYGzBMmd f3TMtM+4Wv/cvTBZSA1WR7r7NWTY7dYycG1EuiM+p6Sl84QmKupIJ4ns8RZ8bJ7v lYkH7XXxPC1q3n4wDWtVItYAiZy6cD4vgUsI6YA+WpHVuVfH85td0vmNpOFrKHdl XFruYAHnjIDkGOe+d0z4TC1pQbKLEZIYhmfd2MhovPuhvMuImjMphjM0WTV7/JXh sgicmc/s28LWlbkjKiDy/qfEZ6oc4kObiNxYHzMpGVoQCXzZkdc= =1xmj -----END PGP SIGNATURE----- NeoMutt 2024-03-29 ```

Finally, you can check the signatures:

Tag: git verify-tag 20240329 ``` gpg: Signature made Fri 29 Mar 2024 14:28:14 GMT gpg: using RSA key 86C2397270DD7A561263CA4E5FAF0A6EE7371805 gpg: Good signature from "Richard Russon (NeoMutt) " [ultimate] ```
Release: git verify-commit 11482a5f7881755c421547fb3a44276b8d758f0f ``` gpg: Signature made Fri 29 Mar 2024 14:27:35 GMT gpg: using RSA key 86C2397270DD7A561263CA4E5FAF0A6EE7371805 gpg: Good signature from "Richard Russon (NeoMutt) " [ultimate] ```

Hope this makes makes sense :-)

nobrowser commented 7 months ago

@roccoblues

git fetch 11482a5

I wonder how this worked. Aren't you supposed to specify the repository?

Right. I meant git fetch origin 11482a5. Sorry to add to the confusion.

roccoblues commented 7 months ago

@nobrowser are you fine with closing this issue?

nobrowser commented 7 months ago

I got what I wanted personally, but I think it is still confusing to others. I think most people, even those who build from source and can get around in git, are used to updating with a plain git fetch or git pull, and this situation will be unexpected to them. Thus, if I were the admin, I'd keep it open. Suggested fix: add one sentence to the release notes on https://neomutt.org

ossilator commented 7 months ago

@flatcap: it isn't particularly good practice to "orphan" tags, exactly because of the confusion caused by a standard fetch skipping such tags. if you don't forward-merge the release branch (which you shouldn't if it contains cherry-picks from the branch you'd have to merge it into), then you should keep it alive indefinitely.

this still can be fixed by simply duplicating the tag into the heads/ namespace. a minor challenge is giving the branch a sensible name, given that you're not using anything resembling semver. i guess i would use stable/20240323 (i.e., use the release you branched off from as the name).

mschilli87 commented 7 months ago

If I want to checkout a specific release, I'd do a git fetch origin --tags assuming each release would be tagged. A plain git fetch will get me all the latest (development) branches, which I do not care at all about in that situtation.

So without reading this thread, I would have gone to https://github.com/neomutt/neomutt/releases, copied the tag name listed in the top left next to the little tag symbol image and then directly tried the following (assuming I didn't have a copy of the repository already):

# Clone the upstream repo and directly request to checkout the tag that I care about.
# Ignore any other branch/tag and do not download any historic information.
git clone \
   --branch 20240329 \
   --single-branch \
   --no-tags \
   --depth=1 \
  'git@github.com:neomutt/neomutt.git'
Cloning into 'neomutt'...
remote: Enumerating objects: 1545, done.
remote: Counting objects: 100% (1545/1545), done.
remote: Compressing objects: 100% (1005/1005), done.
remote: Total 1545 (delta 740), reused 848 (delta 532), pack-reused 0
Receiving objects: 100% (1545/1545), 3.28 MiB | 1.52 MiB/s, done.
Resolving deltas: 100% (740/740), done.
Note: switching to '11482a5f7881755c421547fb3a44276b8d758f0f'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

The warning about detached head might have confused me a little as I am not doing this kind of thing often, but a quick

cd neomutt
git log
commit 11482a5f7881755c421547fb3a44276b8d758f0f (grafted, HEAD, tag: 20240329)
Author: Richard Russon (@flatcap) <rich@flatcap.org>
Date:   Fri Mar 29 14:27:35 2024 +0000

    NeoMutt 2024-03-29

would have calmed me down immediately, especially since I can double-check the commit hash with the one listed on the release page (see above just under the tag name).

Finally, a quick ls would give me confidence I was ready to build that specific release from source:

AUTHORS.md          attach      compose    debug       format_flags.h  helpbar    maildir     mutt.h          mutt_lua.h      mview.h     pop        send         timegm.c
ChangeLog.md        auto.def    compress   docs        fuzz            history    maillist.c  mutt_account.c  mutt_mailbox.c  mx.c        postpone   sidebar      version.c
INSTALL.md          autocrypt   config     editmsg.c   globals.c       hook.c     maillist.h  mutt_account.h  mutt_mailbox.h  mx.h        progress   sort.c       version.h
LICENSE.md          autosetup   configure  editor      globals.h       hook.h     main.c      mutt_body.c     mutt_signal.c   ncrypt      protos.h   sort.h       wcscasecmp.c
Makefile.autosetup  bcache      conn       email       gui             imap       mbox        mutt_body.h     mutt_socket.c   nntp        question   status.c
README.md           browser     contrib    enriched.c  handler.c       index      menu        mutt_config.c   mutt_socket.h   notmuch     recvcmd.c  status.h
SECURITY.md         color       convert    enriched.h  handler.h       init.c     mh          mutt_header.c   mutt_thread.c   pager       recvcmd.h  store
address             commands.c  copy.c     envelope    hcache          init.h     mixmaster   mutt_header.h   mutt_thread.h   parse       rfc3676.c  subjectrx.c
alias               commands.h  copy.h     external.c  hdrline.c       key        monitor.c   mutt_logging.c  muttlib.c       pattern     rfc3676.h  subjectrx.h
alternates.c        complete    core       external.h  hdrline.h       mailcap.c  monitor.h   mutt_logging.h  muttlib.h       pgpewrap.c  score.c    system.c
alternates.h        compmbox    data       flags.c     help.c          mailcap.h  mutt        mutt_lua.c      mview.c         po          score.h    test

Now let's assume I have been tinkering with neomutt before and still have some outdated repository lying around.

# Clean-up the test copy created above.
cd ..
rm -rf neomutt
# Make a new, regular, clone.
git clone 'git@github.com:neomutt/neomutt.git'
Cloning into 'neomutt'...
remote: Enumerating objects: 136352, done.
remote: Counting objects: 100% (284/284), done.
remote: Compressing objects: 100% (176/176), done.
remote: Total 136352 (delta 157), reused 166 (delta 108), pack-reused 136068
Receiving objects: 100% (136352/136352), 155.13 MiB | 2.88 MiB/s, done.
Resolving deltas: 100% (112550/112550), done.
# Change to the repository and forget about the upstream one for now.
cd neomutt
git remote rm origin
# Find the latest commit to the main branch that is more than one year
# older than the release we care about:
git log --before="2023-03-29" -n1
commit fca487cd6c2a7b735f10df6eb20732866c87cac4
Author: Richard Russon (@flatcap) <rich@flatcap.org>
Date:   Wed Mar 29 01:11:13 2023 +0100

    trans: update toggle command
# Travel back in time to that commit.
git reset --hard fca487cd6c2a7b735f10df6eb20732866c87cac4
HEAD is now at fca487cd6 trans: update toggle command
# Remove all tags that been created after that old commit.
git tag --contain=main | xargs -n1 git tag -d
Deleted tag '20230407' (was b5629bac6)
Deleted tag '20230512' (was bea91df3c)
Deleted tag '20230517' (was 3951f38c4)
Deleted tag '20231006' (was af6a15fb8)
Deleted tag '20231023' (was ee1a8c2b6)
Deleted tag '20231103' (was e6bf0adde)
Deleted tag '20231221' (was 817720449)
Deleted tag '20240201' (was b7dd6bda6)
Deleted tag '20240323' (was 9bfa3c05d)
Deleted tag '20240329' (was bca03df09)
# Add back upstream repository.
git remote add origin 'git@github.com:neomutt/neomutt.git'

# Fetch main branch only.
git fetch origin main
From github.com:neomutt/neomutt
 * branch                main       -> FETCH_HEAD
 * [new branch]          main       -> origin/main
# Set local main branch to track upstream again.
git branch --set-upstream-to=origin/main
branch 'main' set up to track 'origin/main'.
# Rewrite FETCH_HEAD to refer to old commit.
sed -i 's/[[:alnum:]]\+/fca487cd6c2a7b735f10df6eb20732866c87cac4/' .git/FETCH_HEAD

# Move back upstream main reference.
echo fca487cd6c2a7b735f10df6eb20732866c87cac4 > .git/refs/remotes/origin/main

# Verify we have restored the old state.
git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
# For good measure, empty the reflog.
git reflog expire --expire=all --all

# Remove all objects not used anymore.
git gc --prune=now
Enumerating objects: 120806, done.
Counting objects: 100% (120806/120806), done.
Delta compression using up to 8 threads
Compressing objects: 100% (20976/20976), done.
Writing objects: 100% (120806/120806), done.
Total 120806 (delta 99501), reused 120804 (delta 99500), pack-reused 0

Now we are as close as I can get us to having an old, regular, clone lying around. From this, I would do the following to checkout the release tag (again, without the need to read this thread):

# Only fetch the tag I care about from upstream, as I know
# the release is tagged and I don't care about (development)
# branches or any other (older or newer) tags.
# Re-create that tag locally using the same name.
# Do not keep track of the tag's history as all I care about
# is its final state.
git fetch \
  --no-tags \
  --depth=1 \
  origin \
  20240329:refs/tags/20240329
remote: Enumerating objects: 2321, done.
remote: Counting objects: 100% (2321/2321), done.
remote: Compressing objects: 100% (791/791), done.
remote: Total 1271 (delta 1076), reused 589 (delta 475), pack-reused 0
Receiving objects: 100% (1271/1271), 1.50 MiB | 913.00 KiB/s, done.
Resolving deltas: 100% (1076/1076), completed with 591 local objects.
From github.com:neomutt/neomutt
 * [new tag]             20240329   -> 20240329
# List the three latest tags to ensure we got the tag we wanted,
# but only the old ones (> 1 year older) in addition.
git tag --sort=-taggerdate | sed 3q
20240329
20230322
20220429
# Checkout the tag.
git checkout 20240329
Note: switching to '20240329'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 11482a5f7 NeoMutt 2024-03-29

We are now back to where we were with the direct clone above:

git log
commit 11482a5f7881755c421547fb3a44276b8d758f0f (grafted, HEAD, tag: 20240329)
Author: Richard Russon (@flatcap) <rich@flatcap.org>
Date:   Fri Mar 29 14:27:35 2024 +0000

    NeoMutt 2024-03-29

However, this time we still got the (old) main branch lying around:

git branch -vv
* (HEAD detached at 20240329) 11482a5f7 NeoMutt 2024-03-29
  main                        fca487cd6 [origin/main] trans: update toggle command

So personally I really do not see any problem with the state of the repository. All one needs is the git tag name which is prominently featured on the corresponding release page.

flatcap commented 7 months ago

Thanks for you input, @ossilator...

it isn't particularly good practice to "orphan" tags...

Yes, I understand.

then you should keep it alive indefinitely.

Yes. The tags are all annotated tags and they won't get deleted.

this still can be fixed by simply duplicating the tag into the heads/ namespace

True, but I'm not going to. That reference only matters to a handful of people, mostly developers and packagers, and only for a couple of weeks. Once I make a new release (which is scheduled for today :-) it's unlikely anyone will consider it again.

Also, branches are clutter that I don't want to look at. Any long-term unmerged branches that contain viable work, or good ideas, are archived to https://github.com/neomutt/neomutt-old

This OCD tidiness means that I always know which branches are active/important. And... Whenever an important fix, or widescale refactoring, is merged, I can give all the branches a free rebase.

given that you're not using anything resembling semver

Yes. This has been discussed on IRC a few times. NeoMutt's development is hard to squeeze into a major/minor pattern.

flatcap commented 7 months ago

Original question answered. Off-topic threshhold reached :-)