[PATCH] Handle tags outside of refs/tags gracefully.

Gianni Ceccarelli dakkar at thenautilus.net
Tue Jan 5 11:53:03 UTC 2021


I have found an annoying case…

In the repository created as per my previous message, I did::

  $ git tag -a foo
  $ git rev-parse refs/tags/foo > .git/refs/weird/annotated
  $ git push origin refs/weird/*:refs/weird/*

This creates an "annotated tag", which is an object in the store, not
just a reference.

Now CGit shows the ``refs/weird/annotated`` as a tag in
https://www.thenautilus.net/cgit/example/ and several other views, but
following that link goes to
https://www.thenautilus.net/cgit/example/tag/?h=refs/weird/annotated
which says "bad tag reference"

I hope you'll concur this is not the best behaviour.

I see several ways to "fix" this:

* in all the various views, don't show links to annotated tags whose
  ref is outside of ``refs/tags/``
* in ``/tag``, try ``refs/tags/$h`` first, and if that doesn't work,
  try ``$h``, and show that only if it's an annotated tag (not just a
  reference)
* create another endpoint (``/atag``?) to show tag objects, and link
  to that one for annotated tags whose ref is outside of
  ``refs/tags/``

-- 
	Dakkar - <Mobilis in mobile>
	GPG public key fingerprint = A071 E618 DD2C 5901 9574
	                             6FE2 40EA 9883 7519 3F88
	                    key id = 0x75193F88



More information about the CGit mailing list