summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder@ira.uka.de>2015-08-10 09:46:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-08-10 17:33:58 (GMT)
commit578625fa918922713a2ecce2b06611e4566778f5 (patch)
treec52e008410a474e5640c02d1093e1cb99e29cce9 /Documentation
parent77bd3ea9f54f1584147b594abc04c26ca516d987 (diff)
downloadgit-578625fa918922713a2ecce2b06611e4566778f5.zip
git-578625fa918922713a2ecce2b06611e4566778f5.tar.gz
git-578625fa918922713a2ecce2b06611e4566778f5.tar.bz2
config: add '--name-only' option to list only variable names
'git config' can only show values or name-value pairs, so if a shell script needs the names of set config variables it has to run 'git config --list' or '--get-regexp' and parse the output to separate config variable names from their values. However, such a parsing can't cope with multi-line values. Though 'git config' can produce null-terminated output for newline-safe parsing, that's of no use in such a case, becase shells can't cope with null characters. Even our own bash completion script suffers from these issues. Help the completion script, and shell scripts in general, by introducing the '--name-only' option to modify the output of '--list' and '--get-regexp' to list only the names of config variables, so they don't have to perform error-prone post processing to separate variable names from their values anymore. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/git-config.txt10
1 files changed, 7 insertions, 3 deletions
diff --git a/Documentation/git-config.txt b/Documentation/git-config.txt
index 02ec096..2608ca7 100644
--- a/Documentation/git-config.txt
+++ b/Documentation/git-config.txt
@@ -14,13 +14,13 @@ SYNOPSIS
'git config' [<file-option>] [type] --replace-all name value [value_regex]
'git config' [<file-option>] [type] [-z|--null] --get name [value_regex]
'git config' [<file-option>] [type] [-z|--null] --get-all name [value_regex]
-'git config' [<file-option>] [type] [-z|--null] --get-regexp name_regex [value_regex]
+'git config' [<file-option>] [type] [-z|--null] [--name-only] --get-regexp name_regex [value_regex]
'git config' [<file-option>] [type] [-z|--null] --get-urlmatch name URL
'git config' [<file-option>] --unset name [value_regex]
'git config' [<file-option>] --unset-all name [value_regex]
'git config' [<file-option>] --rename-section old_name new_name
'git config' [<file-option>] --remove-section name
-'git config' [<file-option>] [-z|--null] -l | --list
+'git config' [<file-option>] [-z|--null] [--name-only] -l | --list
'git config' [<file-option>] --get-color name [default]
'git config' [<file-option>] --get-colorbool name [stdout-is-tty]
'git config' [<file-option>] -e | --edit
@@ -159,7 +159,7 @@ See also <<FILES>>.
-l::
--list::
- List all variables set in config file.
+ List all variables set in config file, along with their values.
--bool::
'git config' will ensure that the output is "true" or "false"
@@ -190,6 +190,10 @@ See also <<FILES>>.
output without getting confused e.g. by values that
contain line breaks.
+--name-only::
+ Output only the names of config variables for `--list` or
+ `--get-regexp`.
+
--get-colorbool name [stdout-is-tty]::
Find the color setting for `name` (e.g. `color.diff`) and output