git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Christian Couder <christian.couder@gmail.com>
To: "SZEDER Gábor" <szeder@ira.uka.de>
Cc: Junio C Hamano <gitster@pobox.com>, git <git@vger.kernel.org>
Subject: Re: [PATCH 1.5/2] config: add options to list only variable names
Date: Thu, 28 May 2015 14:06:40 +0200	[thread overview]
Message-ID: <CAP8UFD32erihiEqkwaR6B09rEW7WJJ=Aq955KqErr3MdfQ3S_w@mail.gmail.com> (raw)
In-Reply-To: <1432757503-5787-1-git-send-email-szeder@ira.uka.de>

On Wed, May 27, 2015 at 10:11 PM, SZEDER Gábor <szeder@ira.uka.de> wrote:
> Recenty I created a multi-line branch description with '.' and '='
> characters on one of the lines, and noticed that fragments of that line
> show up when completing set variable names for 'git config', e.g.:
>
>   $ git config --get branch.b.description
>   Branch description to fool the completion script with a
>   second line containing dot . and equals = characters.
>   $ git config --unset <TAB>
>   ...
>   second line containing dot . and equals
>   ...
>
> The completion script runs 'git config --list' and processes its output to
> strip the values and keep only the variable names.  It does so by looking
> for lines containing '.' and '=' and outputting everything before the '=',
> which was fooled by my multi-line branch description.
>
> A similar issue exists with aliases and pretty format aliases with
> multi-line values, but in that case 'git config --get-regexp' is run and
> subsequent lines don't have to contain either '.' or '=' to fool the
> completion script.
>
> Though 'git config' can produce null-terminated output for newline-safe
> parsing, that's of no use in this case, becase we can't cope with nulls in
> the shell.
>
> Help the completion script by introducing the '--list-names' and
> '--get-names-regexp' options, the "names-only" equivalents of '--list' and
> '--get-regexp', so it doesn't have to separate variable names from their
> values anymore.

Why don't you just add a '--name-only' option that can be used only
with '--list' and '--get-regexp'?

Like:

'git config' [<file-option>] [-z|--null] [--name-only] --get-regexp name_regex

and

'git config' [<file-option>] [-z|--null] [--name-only] -l | --list

?

It seems to me that it would reduce the number of options, and later
if we want to pass a format we could have maybe:

'git config' [<file-option>] [-z|--null] [--name-only |
--format=<format>] --get-regexp name_regex

and

'git config' [<file-option>] [-z|--null] [--name-only |
--format=<format>] -l | --list

Thanks,
Christian.

  reply	other threads:[~2015-05-28 12:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-27 20:07 [PATCH 1/2] config: add options to list only variable names SZEDER Gábor
2015-05-27 20:07 ` [PATCH 2/2] completion: use new 'git config' options to reliably list " SZEDER Gábor
2015-05-27 20:11   ` [PATCH 1.5/2] config: add options to list only " SZEDER Gábor
2015-05-28 12:06     ` Christian Couder [this message]
2015-05-27 21:05   ` [PATCH 2/2] completion: use new 'git config' options to reliably list " Jeff King
2015-05-27 21:04 ` [PATCH 1/2] config: add options to list only " Jeff King
2015-05-27 21:08   ` Jeff King
2015-05-27 21:34   ` SZEDER Gábor
2015-05-27 22:20 ` Junio C Hamano
2015-05-28 12:29 ` [PATCH v2 0/2] config: list only variable names for completion SZEDER Gábor
2015-05-28 12:29   ` [PATCH v2 1/2] config: add options to list only variable names SZEDER Gábor
2015-05-28 19:20     ` Junio C Hamano
2015-05-28 19:36       ` Junio C Hamano
2015-05-29 11:34       ` Christian Couder
2015-05-29 11:39         ` Jeff King
2015-05-28 12:29   ` [PATCH v2 2/2] completion: use new 'git config' options to reliably list " SZEDER Gábor
2015-05-28 20:39   ` [PATCH v2 0/2] config: list only variable names for completion 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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAP8UFD32erihiEqkwaR6B09rEW7WJJ=Aq955KqErr3MdfQ3S_w@mail.gmail.com' \
    --to=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=szeder@ira.uka.de \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).