Re: Bug: `git remote show <remote>` reports different HEAD branch than refs/remotes/<remote>/HEAD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 15, 2017 at 01:58:38PM -0400, Jason Karns wrote:

> > On the other hand, what "git remote show" outputs for HEAD is a name
> > of actually checked-out branch inside that remote repository - it`s
> > what`s stored inside HEAD file of the remote repository root.
> >
> > So it is something set on the _remote_ end, you can`t influence it
> > from your local repository.
> 
> So _this_ is not what I expected. Thanks for clarifying.
> 
> Considering that a fresh clone replicates the remote's default branch
> as the local default for that remote, I wager (in the majority of
> cases) that these two are the same. It would seem that what I would
> like in this case is a feature change to git-remote-show to show both
> the locally-configured and remote-configured defaults for the given
> remote (similar in spirit to how git-remote-show already shows local
> vs remote information: branches and their configurations for
> push/pull).

Yes, I'd agree. This seems like exactly the kind of information that
"remote show" was intended to display.

It should be a pretty straight-forward patch for anybody wanting to get
their feet wet in git development. The trickier half of showing both is
getting the remote information, but we're already doing that. So I think
any patch would want to:

  1. Teach builtin/remote.c:show() to say "Remote HEAD branch" instead
     of just "HEAD branch".

  2. Add a "Local HEAD branch" that shows the local symref. That symref
     is always refs/remotes/<remotename>/HEAD, which can be constructed
     with a strbuf. And then resolve_refdup() can be used to get the
     pointed-to ref (check the returned flags for REF_ISSYMREF, and
     the string return value is the refname).

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux