List for cgit developers and users
 help / color / mirror / Atom feed
From: Gianni Ceccarelli <dakkar@thenautilus.net>
To: cgit@lists.zx2c4.com
Subject: Re: [PATCH] Handle tags outside of refs/tags gracefully.
Date: Tue, 29 Dec 2020 20:33:09 +0000	[thread overview]
Message-ID: <20201229203309.33f1fcae@thenautilus.net> (raw)
In-Reply-To: <CAHmME9rDRjGoXe25qx-XfxpgAsTscz=__PH6exgWB5-4mLdsLg@mail.gmail.com>

On Tue, 2020-12-29 at 12:37:43 +0100, Jason A. Donenfeld wrote:  
> This is for the tag UI, though. Aren't tags supposed to live in
> refs/tags/ by definition?

Yes. The "git tag" manpage says:

>> Add a tag reference in refs/tags/, unless -d/-l/-v is given to
>> delete, list or verify tags

On 2020-12-29 "Jason A. Donenfeld" <Jason@zx2c4.com> wrote:
> The fact that the git CLI handles it properly actually is a compelling
> reason to mimic its logic. How does it handle this scenario? I assume
> it looks up both possibilities and returns the first one that matches?
> In which order does it check?

Depends which sub-command we're talking about::

  $ mkdir /tmp/a
  $ cd /tmp/a
  $ git init
  $ touch foo && git add foo && git commit -m first
  $ mkdir .git/refs/weird && git rev-parse HEAD > .git/refs/weird/thing
  $ git log --decorate
  commit 4081ad6720f3f60f5f11a77f1d932517496e33ba (HEAD -> master, refs/weird/thing)
  Author: dakkar <dakkar@thenautilus.net>
  Date:   2020-12-29 20:10:18 +0000

    first

Now, ``git checkout weird/thing`` works, as does ``git log
weird/thing``, or anything that uses ``rev-parse`` internally.

``git tag`` will *not* show ``weird/thing`` because it's not a tag,
it's a non-tag ref::

  $ git tag -d weird/thing
  error: tag 'weird/thing' not found.

As far as CGit is concerned, these work:

* https://www.thenautilus.net/cgit/example/log/?h=weird/thing
* https://www.thenautilus.net/cgit/example/commit/?h=weird/thing
* https://www.thenautilus.net/cgit/example/tree/?h=weird/thing
* https://www.thenautilus.net/cgit/example/diff/?h=weird/thing

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


  reply	other threads:[~2020-12-29 20:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-28 13:35 Ulrich Spörlein
2020-12-29 11:37 ` Jason A. Donenfeld
2020-12-29 18:22   ` Ulrich Spörlein
2020-12-29 20:04     ` Jason A. Donenfeld
2020-12-29 20:33       ` Gianni Ceccarelli [this message]
2021-01-05 11:53         ` Gianni Ceccarelli
2021-01-05 13:09           ` John Keeping
2021-01-05 13:40             ` Gianni Ceccarelli
     [not found]               ` <CAJ9axoSnfttirTwaVNhZPa73KSw+PCTq_5MVyvUfT7AcDxLXPg@mail.gmail.com>
2021-01-05 17:12                 ` Gianni Ceccarelli

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

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

  git send-email \
    --in-reply-to=20201229203309.33f1fcae@thenautilus.net \
    --to=dakkar@thenautilus.net \
    --cc=cgit@lists.zx2c4.com \
    /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.
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 NNTP newsgroup(s).