git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Jay Soffian <jaysoffian@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH 1/2] add basic branch display tests
Date: Wed, 18 Feb 2009 22:45:04 -0500	[thread overview]
Message-ID: <20090219034504.GA19862@coredump.intra.peff.net> (raw)
In-Reply-To: <20090219033444.GA18970@coredump.intra.peff.net>

On Wed, Feb 18, 2009 at 10:34:44PM -0500, Jeff King wrote:

> We were not testing the output of "git branch" anywhere.

There is one thing that occurred to me while writing these tests that I
wanted to mention.

When we show a remote symref with "git branch -r", it looks like this:

> +cat >expect <<'EOF'
> +  origin/HEAD -> origin/branch-one
> +  origin/branch-one
> +  origin/branch-two
> +EOF
> +test_expect_success 'git branch -r shows remote branches' '
> +	git branch -r >actual &&
> +	test_cmp expect actual
> +'

which makes sense. <remote>/<symref> -> <remote>/<branch>

> +cat >expect <<'EOF'
> +  branch-one
> +  branch-two
> +* master
> +  remotes/origin/HEAD -> origin/branch-one
> +  remotes/origin/branch-one
> +  remotes/origin/branch-two
> +EOF
> +test_expect_success 'git branch -a shows local and remote branches' '
> +	git branch -a >actual &&
> +	test_cmp expect actual
> +'

But here we stick the "remotes/" head on, since we are showing both
types. But the right hand side of the symref doesn't get the same
treatment.

I don't think it's a big deal, but I wasn't sure if it was intentional,
a bug, or simply that nobody cares (and since I have now codified it in
a test script, it seems like we should make sure it is intentional).

I also had a brief thought that reprinting the <remote> is pointless.
That is, printing

  origin/HEAD -> master

shows what is happening with less text due to the context (i.e., we
already know we are talking about remote "origin" -- and if it isn't in
origin, we already show more). But that is probably a bad idea; that
context is missing if you were to try to do something like "git show";
<remote>/<branch> would work, but <branch> wouldn't.

-Peff

  reply	other threads:[~2009-02-19  3:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1234980819u.git.johannes.schindelin@gmx.de>
2009-02-18 18:14 ` [PATCH] Avoid segfault with 'git branch' when the HEAD is detached Johannes Schindelin
2009-02-18 20:36   ` Jay Soffian
2009-02-19  0:45   ` Jeff King
2009-02-19  1:15     ` Johannes Schindelin
2009-02-19  3:24       ` Jeff King
2009-02-19  3:33         ` Jeff King
2009-02-19  3:34           ` [PATCH 1/2] add basic branch display tests Jeff King
2009-02-19  3:45             ` Jeff King [this message]
2009-02-19  3:51               ` Jay Soffian
2009-02-19  3:53                 ` Jeff King
2009-02-19  3:35           ` [PATCH 2/2] branch: clean up repeated strlen Jeff King
2009-02-19 11:31             ` Johannes Schindelin

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=20090219034504.GA19862@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jaysoffian@gmail.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).