git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miklos Vajna <vmiklos@frugalware.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Mikael Magnusson <mikachu@gmail.com>,
	Nguyen Thai Ngoc Duy <pclouds@gmail.com>,
	Johannes Sixt <j.sixt@viscovery.net>,
	Git Mailing List <git@vger.kernel.org>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH] bash-completion: fix getting strategy list
Date: Thu, 21 Aug 2008 16:06:10 +0200	[thread overview]
Message-ID: <20080821140610.GS23800@genesis.frugalware.org> (raw)
In-Reply-To: <7v7iabklas.fsf@gitster.siamese.dyndns.org>

[-- Attachment #1: Type: text/plain, Size: 1697 bytes --]

On Wed, Aug 20, 2008 at 10:07:55PM -0700, Junio C Hamano <gitster@pobox.com> wrote:
> > Yes, there are some weird patch in 'next'.  Miklos, could you fix the
> > output format of that thing?

You were faster. ;-)

> I do not think the code in 'next' that reuses the "help" thing to show
> only the list to stdout while still giving the error message to stderr
> makes any sense.
> 
> Let's do this.
> 
> ---
> 
>  builtin-merge.c |   14 +++++++++++---
>  1 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git c/builtin-merge.c w/builtin-merge.c
> index 1f9389b..3e8db0d 100644
> --- c/builtin-merge.c
> +++ w/builtin-merge.c
> @@ -110,9 +110,17 @@ static struct strategy *get_strategy(const char *name)
>  		}
>  	}
>  	if (!is_in_cmdlist(&main_cmds, name) && !is_in_cmdlist(&other_cmds, name)) {
> -
> -		fprintf(stderr, "Could not find merge strategy '%s'.\n\n", name);
> -		list_commands("strategies", longest, &main_cmds, &other_cmds);
> +		fprintf(stderr, "Could not find merge strategy '%s'.\n", name);
> +		fprintf(stderr, "Available strategies are:");
> +		for (i = 0; i < main_cmds.cnt; i++)
> +			fprintf(stderr, " %s", main_cmds.names[i]->name);
> +		fprintf(stderr, ".\n");
> +		if (other_cmds.cnt) {
> +			fprintf(stderr, "Available custom strategies are:");
> +			for (i = 0; i < other_cmds.cnt; i++)
> +				fprintf(stderr, " %s", other_cmds.names[i]->name);
> +			fprintf(stderr, ".\n");
> +		}
>  		exit(1);
>  	}

Given that we don't have 100+ merge strategies like we have 100+ git
commands, I think printing them in one line should not be problematic,
and this definitely improves script usability, so I like it, thanks.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

      reply	other threads:[~2008-08-21 14:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-19 12:27 [BUG] git completion do sed on binary file Nguyen Thai Ngoc Duy
2008-08-19 13:28 ` [PATCH] bash-completion: fix getting strategy list Nguyen Thai Ngoc Duy
2008-08-19 13:35   ` Matthieu Moy
2008-08-19 13:46     ` Nguyen Thai Ngoc Duy
2008-08-19 14:18   ` Shawn O. Pearce
2008-08-19 14:50   ` Johannes Sixt
2008-08-19 14:57     ` Johannes Sixt
2008-08-20 16:58     ` Nguyen Thai Ngoc Duy
2008-08-20 18:22       ` Junio C Hamano
2008-08-20 21:13       ` Junio C Hamano
2008-08-20 22:39         ` Miklos Vajna
2008-08-21  0:43           ` Nguyen Thai Ngoc Duy
2008-08-21  2:14         ` Mikael Magnusson
2008-08-21  4:45           ` Junio C Hamano
2008-08-21  5:07             ` Junio C Hamano
2008-08-21 14:06               ` Miklos Vajna [this message]

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=20080821140610.GS23800@genesis.frugalware.org \
    --to=vmiklos@frugalware.org \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j.sixt@viscovery.net \
    --cc=mikachu@gmail.com \
    --cc=pclouds@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).