git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git branch -a now reports 'remotes/foo' rather than 'foo'?
@ 2009-05-11  2:16 Daniel Pittman
  2009-05-11  5:26 ` Jay Soffian
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Pittman @ 2009-05-11  2:16 UTC (permalink / raw)
  To: git

G'day.  Debian recently released git 1.6.3 to unstable, so it has just
landed on my desk, and a change in the output of 'git branch' listings
is causing one of the front-ends I use to fail.

In previous versions, in a git-svn repository, I got this output to
'git branch -a':

,----[ git 1.6.2 and earlier ]
| ] git branch -a
| * master
|   tags/16-1
|   tags/18-1
|   tags/19-2
|   trunk
`----

Now, in 1.6.3, I see two different output formats:

,----[ git 1.6.3 ]
| ] git branch -a
| * master
|   remotes/tags/16-1
|   remotes/tags/18-1
|   remotes/tags/19-2
|   remotes/trunk
| ] git branch -r
|   tags/16-1
|   tags/18-1
|   tags/19-2
|   trunk
`----

The front-end I am using looks for a 'trunk' branch by name in the
output of 'git branch -a', which historically worked.  Now, though, it
shows that fully qualified.

Looking at the release notes it looks like this was a deliberate change,
from this entry:

* "git-branch -r" shows HEAD symref that points at a remote branch in
  interest of each tracked remote repository.

However, that isn't unambiguously clear about the change, and is pretty
light on the "why" parts.  Worse, the only discussion I can find about
the change suggests that this was noticed, and there wasn't real clarity
about the background.

(See Jeff King under "[PATCH 1/2] add basic branch display tests" at [1]
 for the details.)


I confess, to me, that having 'git branch -a' and 'git branch -r' emit
different values doesn't make much sense, but I suppose the upstream
code can be adapted.

I wanted to confirm that this was a deliberate change before I went to
the trouble or rewriting the front-end code however.

Regards,
        Daniel

Footnotes: 
[1]  http://thread.gmane.org/gmane.comp.version-control.git/110564/focus=110616

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

* Re: git branch -a now reports 'remotes/foo' rather than 'foo'?
  2009-05-11  2:16 git branch -a now reports 'remotes/foo' rather than 'foo'? Daniel Pittman
@ 2009-05-11  5:26 ` Jay Soffian
  2009-05-11  7:01   ` Daniel Pittman
  0 siblings, 1 reply; 3+ messages in thread
From: Jay Soffian @ 2009-05-11  5:26 UTC (permalink / raw)
  To: Daniel Pittman; +Cc: git

On Sun, May 10, 2009 at 10:16 PM, Daniel Pittman <daniel@rimspace.net> wrote:
> The front-end I am using looks for a 'trunk' branch by name in the
> output of 'git branch -a', which historically worked.  Now, though, it
> shows that fully qualified.
>
> Looking at the release notes it looks like this was a deliberate change,
> from this entry:
>
> * "git-branch -r" shows HEAD symref that points at a remote branch in
>  interest of each tracked remote repository.
>
> However, that isn't unambiguously clear about the change, and is pretty
> light on the "why" parts.  Worse, the only discussion I can find about
> the change suggests that this was noticed, and there wasn't real clarity
> about the background.
>
> (See Jeff King under "[PATCH 1/2] add basic branch display tests" at [1]
>  for the details.)
>
>
> I confess, to me, that having 'git branch -a' and 'git branch -r' emit
> different values doesn't make much sense, but I suppose the upstream
> code can be adapted.
>
> I wanted to confirm that this was a deliberate change before I went to
> the trouble or rewriting the front-end code however.

Yes, the change was deliberate. Commit 209d336 (builtin-branch:
improve output when displaying remote branches, 2009-02-13) has more
details:

    When displaying local and remote branches, prefix the remote branch
    names with "remotes/" to make the remote branches clear from the local
    branches. If displaying only the remote branches, the prefix is not
    shown since it would be redundant.

When you fix your front-end, I suggest you stop parsing git branch's
output. It is a so-called porcelain command, as opposed to a  plumbing
command, and so its output is subject to change. You probably want to
use the for-each-ref command instead.

j.

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

* Re: git branch -a now reports 'remotes/foo' rather than 'foo'?
  2009-05-11  5:26 ` Jay Soffian
@ 2009-05-11  7:01   ` Daniel Pittman
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Pittman @ 2009-05-11  7:01 UTC (permalink / raw)
  To: git

Jay Soffian <jaysoffian@gmail.com> writes:
> On Sun, May 10, 2009 at 10:16 PM, Daniel Pittman <daniel@rimspace.net> wrote:
>> The front-end I am using looks for a 'trunk' branch by name in the
>> output of 'git branch -a', which historically worked.  Now, though, it
>> shows that fully qualified.

[...]

>> I wanted to confirm that this was a deliberate change before I went to
>> the trouble or rewriting the front-end code however.
>
> Yes, the change was deliberate. Commit 209d336 (builtin-branch:
> improve output when displaying remote branches, 2009-02-13) has more
> details:
>
>     When displaying local and remote branches, prefix the remote
>     branch names with "remotes/" to make the remote branches clear
>     from the local branches.

Isn't the use of colour sufficient to do this?  Ah, well.  That horse,
I think, has bolted, and my own end-users thoughts about the incoherence
are, I suspect, of little relevance now.

>     If displaying only the remote branches, the prefix is not shown
>     since it would be redundant.
>
> When you fix your front-end, I suggest you stop parsing git branch's
> output. It is a so-called porcelain command, as opposed to a plumbing
> command, and so its output is subject to change. You probably want to
> use the for-each-ref command instead.

It isn't my front-end, but I shall take a look and see if I can send
upstream a suitable patch.  Thanks for the advice.

Regards,
        Daniel

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

end of thread, other threads:[~2009-05-11  7:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-11  2:16 git branch -a now reports 'remotes/foo' rather than 'foo'? Daniel Pittman
2009-05-11  5:26 ` Jay Soffian
2009-05-11  7:01   ` Daniel Pittman

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