git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [GIT BUG] show-ref doesn't work with Symbolic Refs other than HEAD
       [not found] <46A996A1-4B9D-4613-A49B-A95E98119DFA@strongestfamilies.com>
@ 2019-12-20 20:04 ` Casey Meijer
  2019-12-20 20:21   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Casey Meijer @ 2019-12-20 20:04 UTC (permalink / raw)
  To: git@vger.kernel.org

`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`
 
 
Best,
 
Casey Meijer


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [GIT BUG] show-ref doesn't work with Symbolic Refs other than HEAD
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2019-12-20 20:21 UTC (permalink / raw)
  To: Casey Meijer; +Cc: git@vger.kernel.org

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [GIT BUG] show-ref doesn't work with Symbolic Refs other than HEAD
  2019-12-20 20:21   ` Junio C Hamano
@ 2019-12-23 14:59     ` Casey Meijer
  0 siblings, 0 replies; 3+ messages in thread
From: Casey Meijer @ 2019-12-23 14:59 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git@vger.kernel.org

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.
    


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-12-23 14:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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

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).