git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Casey Meijer <cmeijer@strongestfamilies.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [GIT BUG] show-ref doesn't work with Symbolic Refs other than HEAD
Date: Mon, 23 Dec 2019 14:59:27 +0000	[thread overview]
Message-ID: <07BD46C7-19F0-47EE-B6AB-23C300C8F690@strongestfamilies.com> (raw)
In-Reply-To: <xmqqo8w2928s.fsf@gitster-ct.c.googlers.com>

I see.  Perhaps an enhancement then?

It's not at all intuitive that show-ref isn't able to show refs, symbolic or not. 

To clarify: I don't at all expect show-ref to change what it displays to be the "interesting branch" on the remote, nor to output the branch that a symbolic ref points at. 

I would expect it to show the commit SHA (useful) and the ref-name (not super useful), as it does for other refs (though perhaps the dereference option could be reused here somehow to give both options?).

In any case, no serious concern since `symbolic-ref` works, just a weird inconsistency. 

The documentation could certainly be improved.  I would just add a line "show-ref does not inspect or follow symbolic references like HEAD or those made with symbolic-ref" to the summary at the top.  Something like the following:
 
"""
Displays references available in a local repository along with the associated commit IDs. Results can be filtered using a pattern and tags can be dereferenced into object IDs. Additionally, it can be used to test whether a particular ref exists. 

By default, shows the tags, heads, and remote refs.  It does not ever inspect or follow symbolic references like HEAD or those made with `git symbolic-ref NAME REF`.

The --exclude-existing form is a filter that does the inverse. It reads refs from stdin, one ref per line, and shows those that don’t exist in the local repository.

Use of this utility is encouraged in favor of directly accessing files under the .git directory.
"""

Thanks for taking a look!

Best,

Casey  

On 2019-12-20, 4:22 PM, "Junio C Hamano" <gitster@pobox.com> wrote:

    Casey Meijer <cmeijer@strongestfamilies.com> writes:
    
    > `git version 2.21.0`
    >  
    > Example
    > ------------
    >  
    > `git symbolic-ref DEV refs/heads/dev`
    > `git symbolic-ref DEV`
    > `>> refs/heads/dev
    > `git show-ref DEV`
    > `>> [NO OUTPUT]`
    >  
    > Expected output
    > ---------------------
    >  
    > `FULL_COMMIT_HASH refs/heads/dev`
    
    What made you expect such an output?  That may be caused by a
    documentation bug or two, which may well be worth fixing.
    
    The show-ref command never resolves a symbolic ref to its pointee,
    and it only shows things under refs/ hierarchy.
    
    And DEV is not special.
    
    	git show-ref HEAD
    
    would not show HEAD (i.e. the commit that is at the tip of the
    current branch), and it would show refs/remotes/origin/HEAD in a
    repository cloned from elsewhere but it does not say what other ref
    is pointed at (in other words, what the remote repository considered
    the primarily interesting branch).
    
    Thanks.
    


      reply	other threads:[~2019-12-23 14:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <46A996A1-4B9D-4613-A49B-A95E98119DFA@strongestfamilies.com>
2019-12-20 20:04 ` [GIT BUG] show-ref doesn't work with Symbolic Refs other than HEAD Casey Meijer
2019-12-20 20:21   ` Junio C Hamano
2019-12-23 14:59     ` Casey Meijer [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=07BD46C7-19F0-47EE-B6AB-23C300C8F690@strongestfamilies.com \
    --to=cmeijer@strongestfamilies.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).