git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Jean-Noël AVILA" <jn.avila@free.fr>, git@vger.kernel.org
Subject: Re: [RFC] Instruct git-completion.bash that we are in test mode
Date: Mon, 21 Jan 2013 19:39:55 -0500	[thread overview]
Message-ID: <20130122003954.GA23297@sigill.intra.peff.net> (raw)
In-Reply-To: <7v7gn6f6ya.fsf@alter.siamese.dyndns.org>

On Mon, Jan 21, 2013 at 03:32:29PM -0800, Junio C Hamano wrote:

> "Jean-Noël AVILA" <jn.avila@free.fr> writes:
> 
> > At least, "it works for me".
> 
> I suspect that your approach will still not fix the case in which
> you build a branch with a new command git-check-ignore, and then
> check out another branch that does not yet have that command without
> first running "make clean".
> 
> Does the following really pass with your patch?
> 
> 	git checkout origin/next
>         make
>         git checkout origin/maint
> 	git apply your_patch.mbox
>         make
>         cd t && sh ./t9902-completion.sh

I really hate to suggest this, but should it be more like:

  if test -z "$FAKE_COMMAND_LIST"; then
          __git_cmdlist() {
                  git help -a | egrep '^  [a-zA-Z0-9]'
          }
  else
          __git_cmdlist() {
                  printf '%s' "$FAKE_COMMAND_LIST"
          }
  fi

That gives us a nice predictable starting point for actually testing the
completion code. The downside is that it  doesn't let us test that we
remain compatible with the output of "help -a". But we could potentially
add a single, more liberal test (without $FAKE_COMMAND_LIST, but ready
to expect extra output) that checks that.

> > +	__git_cmdlist () { git help -a| egrep -m 1 -B1000 PATH | egrep '^  [a-zA-Z0-9]'; }
> 
> 'egrep' is not even in POSIX in the first place but grep -E ought to
> be a replacement for it, so I'll let it pass, but "-m1 -B1000"?
> Please stay within portable options.

If I recall correctly, egrep is actually more portable than "grep -E"
(and it is already in use, so I think we are OK). I agree on the rest,
though. :)

-Peff

  reply	other threads:[~2013-01-22  0:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-21 22:30 [RFC] Instruct git-completion.bash that we are in test mode Jean-Noël AVILA
2013-01-21 23:32 ` Junio C Hamano
2013-01-22  0:39   ` Jeff King [this message]
2013-01-22  4:31     ` Junio C Hamano
2013-01-22  8:04       ` Jean-Noël Avila
2013-01-22 16:31         ` Junio C Hamano
2013-01-24 23:07     ` [PATCH] t9902: protect test from stray build artifacts Junio C Hamano
2013-01-25  1:13       ` Jeff King
2013-01-25  2:59         ` Jonathan Nieder
2013-01-25  4:11         ` Junio C Hamano
2013-01-25  4:13           ` Jeff King
2013-01-25  4:19           ` Junio C Hamano
2013-01-25  4:23             ` Jeff King
2013-01-25 18:34               ` Junio C Hamano
2013-01-25 22:06                 ` Jeff King

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=20130122003954.GA23297@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jn.avila@free.fr \
    /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).