... and adjust all references.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-clone-pack
git-commit
git-commit-tree
-git-config-set
git-convert-objects
git-count-objects
git-cvsexportcommit
git-receive-pack
git-relink
git-repack
+git-repo-config
git-request-pull
git-reset
git-resolve
+++ /dev/null
-git-config-set(1)
-===============
-
-NAME
-----
-git-config-set - Set options in .git/config.
-
-
-SYNOPSIS
---------
-'git-config-set' name [value [value_regex]]
-'git-config-set' --replace-all name [value [value_regex]]
-'git-config-set' --get name [value_regex]
-'git-config-set' --get-all name [value_regex]
-'git-config-set' --unset name [value_regex]
-'git-config-set' --unset-all name [value_regex]
-
-DESCRIPTION
------------
-You can query/set/replace/unset options with this command. The name is
-actually the section and the key separated by a dot, and the value will be
-escaped.
-
-If you want to set/unset an option which can occor on multiple lines, you
-should provide a POSIX regex for the value. If you want to handle the lines
-*not* matching the regex, just prepend a single exlamation mark in front
-(see EXAMPLES).
-
-This command will fail if
-
-. .git/config is invalid,
-. .git/config can not be written to,
-. no section was provided,
-. the section or key is invalid,
-. you try to unset an option which does not exist, or
-. you try to unset/set an option for which multiple lines match.
-
-
-OPTIONS
--------
-
---replace-all::
- Default behaviour is to replace at most one line. This replaces
- all lines matching the key (and optionally the value_regex)
-
---get::
- Get the value for a given key (optionally filtered by a regex
- matching the value).
-
---get-all::
- Like get, but does not fail if the number of values for the key
- is not exactly one.
-
---unset::
- Remove the line matching the key from .git/config.
-
---unset-all::
- Remove all matching lines from .git/config.
-
-
-EXAMPLE
--------
-
-Given a .git/config like this:
-
- #
- # This is the config file, and
- # a '#' or ';' character indicates
- # a comment
- #
-
- ; core variables
- [core]
- ; Don't trust file modes
- filemode = false
-
- ; Our diff algorithm
- [diff]
- external = "/usr/local/bin/gnu-diff -u"
- renames = true
-
- ; Proxy settings
- [proxy]
- command="ssh" for "ssh://kernel.org/"
- command="proxy-command" for kernel.org
- command="myprotocol-command" for "my://"
- command=default-proxy ; for all the rest
-
-you can set the filemode to true with
-
-------------
-% git config-set core.filemode true
-------------
-
-The hypothetic proxy command entries actually have a postfix to discern
-to what URL they apply. Here is how to change the entry for kernel.org
-to "ssh".
-
-------------
-% git config-set proxy.command '"ssh" for kernel.org' 'for kernel.org$'
-------------
-
-This makes sure that only the key/value pair for kernel.org is replaced.
-
-To delete the entry for renames, do
-
-------------
-% git config-set --unset diff.renames
-------------
-
-If you want to delete an entry for a multivar (like proxy.command above),
-you have to provide a regex matching the value of exactly one line.
-
-To query the value for a given key, do
-
-------------
-% git config-set --get core.filemode
-------------
-
-or
-
-------------
-% git config-set core.filemode
-------------
-
-or, to query a multivar:
-
-------------
-% git config-set --get proxy.command "for kernel.org$"
-------------
-
-If you want to know all the values for a multivar, do:
-
-------------
-% git config-set --get-all proxy.command
-------------
-
-If you like to live dangerous, you can replace *all* proxy.commands by a
-new one with
-
-------------
-% git config-set --replace-all proxy.command ssh
-------------
-
-However, if you really only want to replace the line for the default proxy,
-i.e. the one without a "for ..." postfix, do something like this:
-
-------------
-% git config-set proxy.command ssh '! for '
-------------
-
-To actually match only values with an exclamation mark, you have to
-
-------------
-% git config-set section.key value '[!]'
-------------
-
-
-Author
-------
-Written by Johannes Schindelin <Johannes.Schindelin@gmx.de>
-
-Documentation
---------------
-Documentation by Johannes Schindelin.
-
-GIT
----
-Part of the gitlink:git[7] suite
-
--- /dev/null
+git-repo-config(1)
+==================
+
+NAME
+----
+git-repo-config - Get and set options in .git/config.
+
+
+SYNOPSIS
+--------
+'git-repo-config' name [value [value_regex]]
+'git-repo-config' --replace-all name [value [value_regex]]
+'git-repo-config' --get name [value_regex]
+'git-repo-config' --get-all name [value_regex]
+'git-repo-config' --unset name [value_regex]
+'git-repo-config' --unset-all name [value_regex]
+
+DESCRIPTION
+-----------
+You can query/set/replace/unset options with this command. The name is
+actually the section and the key separated by a dot, and the value will be
+escaped.
+
+If you want to set/unset an option which can occor on multiple lines, you
+should provide a POSIX regex for the value. If you want to handle the lines
+*not* matching the regex, just prepend a single exlamation mark in front
+(see EXAMPLES).
+
+This command will fail if
+
+. .git/config is invalid,
+. .git/config can not be written to,
+. no section was provided,
+. the section or key is invalid,
+. you try to unset an option which does not exist, or
+. you try to unset/set an option for which multiple lines match.
+
+
+OPTIONS
+-------
+
+--replace-all::
+ Default behaviour is to replace at most one line. This replaces
+ all lines matching the key (and optionally the value_regex)
+
+--get::
+ Get the value for a given key (optionally filtered by a regex
+ matching the value).
+
+--get-all::
+ Like get, but does not fail if the number of values for the key
+ is not exactly one.
+
+--unset::
+ Remove the line matching the key from .git/config.
+
+--unset-all::
+ Remove all matching lines from .git/config.
+
+
+EXAMPLE
+-------
+
+Given a .git/config like this:
+
+ #
+ # This is the config file, and
+ # a '#' or ';' character indicates
+ # a comment
+ #
+
+ ; core variables
+ [core]
+ ; Don't trust file modes
+ filemode = false
+
+ ; Our diff algorithm
+ [diff]
+ external = "/usr/local/bin/gnu-diff -u"
+ renames = true
+
+ ; Proxy settings
+ [proxy]
+ command="ssh" for "ssh://kernel.org/"
+ command="proxy-command" for kernel.org
+ command="myprotocol-command" for "my://"
+ command=default-proxy ; for all the rest
+
+you can set the filemode to true with
+
+------------
+% git repo-config core.filemode true
+------------
+
+The hypothetic proxy command entries actually have a postfix to discern
+to what URL they apply. Here is how to change the entry for kernel.org
+to "ssh".
+
+------------
+% git repo-config proxy.command '"ssh" for kernel.org' 'for kernel.org$'
+------------
+
+This makes sure that only the key/value pair for kernel.org is replaced.
+
+To delete the entry for renames, do
+
+------------
+% git repo-config --unset diff.renames
+------------
+
+If you want to delete an entry for a multivar (like proxy.command above),
+you have to provide a regex matching the value of exactly one line.
+
+To query the value for a given key, do
+
+------------
+% git repo-config --get core.filemode
+------------
+
+or
+
+------------
+% git repo-config core.filemode
+------------
+
+or, to query a multivar:
+
+------------
+% git repo-config --get proxy.command "for kernel.org$"
+------------
+
+If you want to know all the values for a multivar, do:
+
+------------
+% git repo-config --get-all proxy.command
+------------
+
+If you like to live dangerous, you can replace *all* proxy.commands by a
+new one with
+
+------------
+% git repo-config --replace-all proxy.command ssh
+------------
+
+However, if you really only want to replace the line for the default proxy,
+i.e. the one without a "for ..." postfix, do something like this:
+
+------------
+% git repo-config proxy.command ssh '! for '
+------------
+
+To actually match only values with an exclamation mark, you have to
+
+------------
+% git repo-config section.key value '[!]'
+------------
+
+
+Author
+------
+Written by Johannes Schindelin <Johannes.Schindelin@gmx.de>
+
+Documentation
+--------------
+Documentation by Johannes Schindelin.
+
+GIT
+---
+Part of the gitlink:git[7] suite
+
gitlink:git-commit-tree[1]::
Creates a new commit object
-gitlink:git-config-set[1]::
- Set options in .git/config.
-
gitlink:git-hash-object[1]::
Computes the object ID from a file.
gitlink:git-read-tree[1]::
Reads tree information into the directory index
+gitlink:git-repo-config[1]::
+ Get and set options in .git/config.
+
gitlink:git-unpack-objects[1]::
Unpacks objects out of a packed archive.
git-unpack-objects$X git-update-index$X git-update-server-info$X \
git-upload-pack$X git-verify-pack$X git-write-tree$X \
git-update-ref$X git-symbolic-ref$X git-check-ref-format$X \
- git-name-rev$X git-pack-redundant$X git-config-set$X git-var$X
+ git-name-rev$X git-pack-redundant$X git-repo-config$X git-var$X
# what 'all' will build and 'install' will install.
ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS) git$X
+++ /dev/null
-#include "cache.h"
-#include <regex.h>
-
-static const char git_config_set_usage[] =
-"git-config-set [--get | --get-all | --replace-all | --unset | --unset-all] name [value [value_regex]]";
-
-static char* key = NULL;
-static char* value = NULL;
-static regex_t* regex = NULL;
-static int do_all = 0;
-static int do_not_match = 0;
-static int seen = 0;
-
-static int show_config(const char* key_, const char* value_)
-{
- if (!strcmp(key_, key) &&
- (regex == NULL ||
- (do_not_match ^
- !regexec(regex, value_, 0, NULL, 0)))) {
- if (do_all) {
- printf("%s\n", value_);
- return 0;
- }
- if (seen > 0) {
- fprintf(stderr, "More than one value: %s\n", value);
- free(value);
- }
- value = strdup(value_);
- seen++;
- }
- return 0;
-}
-
-static int get_value(const char* key_, const char* regex_)
-{
- int i;
-
- key = malloc(strlen(key_)+1);
- for (i = 0; key_[i]; i++)
- key[i] = tolower(key_[i]);
- key[i] = 0;
-
- if (regex_) {
- if (regex_[0] == '!') {
- do_not_match = 1;
- regex_++;
- }
-
- regex = (regex_t*)malloc(sizeof(regex_t));
- if (regcomp(regex, regex_, REG_EXTENDED)) {
- fprintf(stderr, "Invalid pattern: %s\n", regex_);
- return -1;
- }
- }
-
- i = git_config(show_config);
- if (value) {
- printf("%s\n", value);
- free(value);
- }
- free(key);
- if (regex) {
- regfree(regex);
- free(regex);
- }
-
- if (do_all)
- return 0;
-
- return seen == 1 ? 0 : 1;
-}
-
-int main(int argc, const char **argv)
-{
- setup_git_directory();
- switch (argc) {
- case 2:
- return get_value(argv[1], NULL);
- case 3:
- if (!strcmp(argv[1], "--unset"))
- return git_config_set(argv[2], NULL);
- else if (!strcmp(argv[1], "--unset-all"))
- return git_config_set_multivar(argv[2], NULL, NULL, 1);
- else if (!strcmp(argv[1], "--get"))
- return get_value(argv[2], NULL);
- else if (!strcmp(argv[1], "--get-all")) {
- do_all = 1;
- return get_value(argv[2], NULL);
- } else
-
- return git_config_set(argv[1], argv[2]);
- case 4:
- if (!strcmp(argv[1], "--unset"))
- return git_config_set_multivar(argv[2], NULL, argv[3], 0);
- else if (!strcmp(argv[1], "--unset-all"))
- return git_config_set_multivar(argv[2], NULL, argv[3], 1);
- else if (!strcmp(argv[1], "--get"))
- return get_value(argv[2], argv[3]);
- else if (!strcmp(argv[1], "--get-all")) {
- do_all = 1;
- return get_value(argv[2], argv[3]);
- } else if (!strcmp(argv[1], "--replace-all"))
-
- return git_config_set_multivar(argv[2], argv[3], NULL, 1);
- else
-
- return git_config_set_multivar(argv[1], argv[2], argv[3], 0);
- case 5:
- if (!strcmp(argv[1], "--replace-all"))
- return git_config_set_multivar(argv[2], argv[3], argv[4], 1);
- case 1:
- default:
- usage(git_config_set_usage);
- }
- return 0;
-}
--- /dev/null
+#include "cache.h"
+#include <regex.h>
+
+static const char git_config_set_usage[] =
+"git-repo-config [--get | --get-all | --replace-all | --unset | --unset-all] name [value [value_regex]]";
+
+static char* key = NULL;
+static char* value = NULL;
+static regex_t* regex = NULL;
+static int do_all = 0;
+static int do_not_match = 0;
+static int seen = 0;
+
+static int show_config(const char* key_, const char* value_)
+{
+ if (!strcmp(key_, key) &&
+ (regex == NULL ||
+ (do_not_match ^
+ !regexec(regex, value_, 0, NULL, 0)))) {
+ if (do_all) {
+ printf("%s\n", value_);
+ return 0;
+ }
+ if (seen > 0) {
+ fprintf(stderr, "More than one value: %s\n", value);
+ free(value);
+ }
+ value = strdup(value_);
+ seen++;
+ }
+ return 0;
+}
+
+static int get_value(const char* key_, const char* regex_)
+{
+ int i;
+
+ key = malloc(strlen(key_)+1);
+ for (i = 0; key_[i]; i++)
+ key[i] = tolower(key_[i]);
+ key[i] = 0;
+
+ if (regex_) {
+ if (regex_[0] == '!') {
+ do_not_match = 1;
+ regex_++;
+ }
+
+ regex = (regex_t*)malloc(sizeof(regex_t));
+ if (regcomp(regex, regex_, REG_EXTENDED)) {
+ fprintf(stderr, "Invalid pattern: %s\n", regex_);
+ return -1;
+ }
+ }
+
+ i = git_config(show_config);
+ if (value) {
+ printf("%s\n", value);
+ free(value);
+ }
+ free(key);
+ if (regex) {
+ regfree(regex);
+ free(regex);
+ }
+
+ if (do_all)
+ return 0;
+
+ return seen == 1 ? 0 : 1;
+}
+
+int main(int argc, const char **argv)
+{
+ setup_git_directory();
+ switch (argc) {
+ case 2:
+ return get_value(argv[1], NULL);
+ case 3:
+ if (!strcmp(argv[1], "--unset"))
+ return git_config_set(argv[2], NULL);
+ else if (!strcmp(argv[1], "--unset-all"))
+ return git_config_set_multivar(argv[2], NULL, NULL, 1);
+ else if (!strcmp(argv[1], "--get"))
+ return get_value(argv[2], NULL);
+ else if (!strcmp(argv[1], "--get-all")) {
+ do_all = 1;
+ return get_value(argv[2], NULL);
+ } else
+
+ return git_config_set(argv[1], argv[2]);
+ case 4:
+ if (!strcmp(argv[1], "--unset"))
+ return git_config_set_multivar(argv[2], NULL, argv[3], 0);
+ else if (!strcmp(argv[1], "--unset-all"))
+ return git_config_set_multivar(argv[2], NULL, argv[3], 1);
+ else if (!strcmp(argv[1], "--get"))
+ return get_value(argv[2], argv[3]);
+ else if (!strcmp(argv[1], "--get-all")) {
+ do_all = 1;
+ return get_value(argv[2], argv[3]);
+ } else if (!strcmp(argv[1], "--replace-all"))
+
+ return git_config_set_multivar(argv[2], argv[3], NULL, 1);
+ else
+
+ return git_config_set_multivar(argv[1], argv[2], argv[3], 0);
+ case 5:
+ if (!strcmp(argv[1], "--replace-all"))
+ return git_config_set_multivar(argv[2], argv[3], argv[4], 1);
+ case 1:
+ default:
+ usage(git_config_set_usage);
+ }
+ return 0;
+}
+++ /dev/null
-#!/bin/sh
-#
-# Copyright (c) 2005 Johannes Schindelin
-#
-
-test_description='Test git-config-set in different settings'
-
-. ./test-lib.sh
-
-test -f .git/config && rm .git/config
-
-git-config-set core.penguin "little blue"
-
-cat > expect << EOF
-#
-# This is the config file
-#
-
-[core]
- penguin = little blue
-EOF
-
-test_expect_success 'initial' 'cmp .git/config expect'
-
-git-config-set Core.Movie BadPhysics
-
-cat > expect << EOF
-#
-# This is the config file
-#
-
-[core]
- penguin = little blue
- Movie = BadPhysics
-EOF
-
-test_expect_success 'mixed case' 'cmp .git/config expect'
-
-git-config-set Cores.WhatEver Second
-
-cat > expect << EOF
-#
-# This is the config file
-#
-
-[core]
- penguin = little blue
- Movie = BadPhysics
-[Cores]
- WhatEver = Second
-EOF
-
-test_expect_success 'similar section' 'cmp .git/config expect'
-
-git-config-set CORE.UPPERCASE true
-
-cat > expect << EOF
-#
-# This is the config file
-#
-
-[core]
- penguin = little blue
- Movie = BadPhysics
- UPPERCASE = true
-[Cores]
- WhatEver = Second
-EOF
-
-test_expect_success 'similar section' 'cmp .git/config expect'
-
-test_expect_success 'replace with non-match' \
- 'git-config-set core.penguin kingpin !blue'
-
-test_expect_success 'replace with non-match (actually matching)' \
- 'git-config-set core.penguin "very blue" !kingpin'
-
-cat > expect << EOF
-#
-# This is the config file
-#
-
-[core]
- penguin = very blue
- Movie = BadPhysics
- UPPERCASE = true
- penguin = kingpin
-[Cores]
- WhatEver = Second
-EOF
-
-test_expect_success 'non-match result' 'cmp .git/config expect'
-
-cat > .git/config << EOF
-[beta] ; silly comment # another comment
-noIndent= sillyValue ; 'nother silly comment
-
-# empty line
- ; comment
- haha ="beta" # last silly comment
-haha = hello
- haha = bello
-[nextSection] noNewline = ouch
-EOF
-
-cp .git/config .git/config2
-
-test_expect_success 'multiple unset' \
- 'git-config-set --unset-all beta.haha'
-
-cat > expect << EOF
-[beta] ; silly comment # another comment
-noIndent= sillyValue ; 'nother silly comment
-
-# empty line
- ; comment
-[nextSection] noNewline = ouch
-EOF
-
-test_expect_success 'multiple unset is correct' 'cmp .git/config expect'
-
-mv .git/config2 .git/config
-
-test_expect_success '--replace-all' \
- 'git-config-set --replace-all beta.haha gamma'
-
-cat > expect << EOF
-[beta] ; silly comment # another comment
-noIndent= sillyValue ; 'nother silly comment
-
-# empty line
- ; comment
- haha = gamma
-[nextSection] noNewline = ouch
-EOF
-
-test_expect_success 'all replaced' 'cmp .git/config expect'
-
-git-config-set beta.haha alpha
-
-cat > expect << EOF
-[beta] ; silly comment # another comment
-noIndent= sillyValue ; 'nother silly comment
-
-# empty line
- ; comment
- haha = alpha
-[nextSection] noNewline = ouch
-EOF
-
-test_expect_success 'really mean test' 'cmp .git/config expect'
-
-git-config-set nextsection.nonewline wow
-
-cat > expect << EOF
-[beta] ; silly comment # another comment
-noIndent= sillyValue ; 'nother silly comment
-
-# empty line
- ; comment
- haha = alpha
-[nextSection]
- nonewline = wow
-EOF
-
-test_expect_success 'really really mean test' 'cmp .git/config expect'
-
-test_expect_success 'get value' 'test alpha = $(git-config-set beta.haha)'
-git-config-set --unset beta.haha
-
-cat > expect << EOF
-[beta] ; silly comment # another comment
-noIndent= sillyValue ; 'nother silly comment
-
-# empty line
- ; comment
-[nextSection]
- nonewline = wow
-EOF
-
-test_expect_success 'unset' 'cmp .git/config expect'
-
-git-config-set nextsection.NoNewLine "wow2 for me" "for me$"
-
-cat > expect << EOF
-[beta] ; silly comment # another comment
-noIndent= sillyValue ; 'nother silly comment
-
-# empty line
- ; comment
-[nextSection]
- nonewline = wow
- NoNewLine = wow2 for me
-EOF
-
-test_expect_success 'multivar' 'cmp .git/config expect'
-
-test_expect_success 'non-match' \
- 'git-config-set --get nextsection.nonewline !for'
-
-test_expect_success 'non-match value' \
- 'test wow = $(git-config-set --get nextsection.nonewline !for)'
-
-test_expect_failure 'ambiguous get' \
- 'git-config-set --get nextsection.nonewline'
-
-test_expect_success 'get multivar' \
- 'git-config-set --get-all nextsection.nonewline'
-
-git-config-set nextsection.nonewline "wow3" "wow$"
-
-cat > expect << EOF
-[beta] ; silly comment # another comment
-noIndent= sillyValue ; 'nother silly comment
-
-# empty line
- ; comment
-[nextSection]
- nonewline = wow3
- NoNewLine = wow2 for me
-EOF
-
-test_expect_success 'multivar replace' 'cmp .git/config expect'
-
-test_expect_failure 'ambiguous value' 'git-config-set nextsection.nonewline'
-
-test_expect_failure 'ambiguous unset' \
- 'git-config-set --unset nextsection.nonewline'
-
-test_expect_failure 'invalid unset' \
- 'git-config-set --unset somesection.nonewline'
-
-git-config-set --unset nextsection.nonewline "wow3$"
-
-cat > expect << EOF
-[beta] ; silly comment # another comment
-noIndent= sillyValue ; 'nother silly comment
-
-# empty line
- ; comment
-[nextSection]
- NoNewLine = wow2 for me
-EOF
-
-test_expect_success 'multivar unset' 'cmp .git/config expect'
-
-test_expect_failure 'invalid key' 'git-config-set inval.2key blabla'
-
-test_expect_success 'correct key' 'git-config-set 123456.a123 987'
-
-test_expect_success 'hierarchical section' \
- 'git-config-set 1.2.3.alpha beta'
-
-cat > expect << EOF
-[beta] ; silly comment # another comment
-noIndent= sillyValue ; 'nother silly comment
-
-# empty line
- ; comment
-[nextSection]
- NoNewLine = wow2 for me
-[123456]
- a123 = 987
-[1.2.3]
- alpha = beta
-EOF
-
-test_expect_success 'hierarchical section value' 'cmp .git/config expect'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+#
+# Copyright (c) 2005 Johannes Schindelin
+#
+
+test_description='Test git-repo-config in different settings'
+
+. ./test-lib.sh
+
+test -f .git/config && rm .git/config
+
+git-repo-config core.penguin "little blue"
+
+cat > expect << EOF
+#
+# This is the config file
+#
+
+[core]
+ penguin = little blue
+EOF
+
+test_expect_success 'initial' 'cmp .git/config expect'
+
+git-repo-config Core.Movie BadPhysics
+
+cat > expect << EOF
+#
+# This is the config file
+#
+
+[core]
+ penguin = little blue
+ Movie = BadPhysics
+EOF
+
+test_expect_success 'mixed case' 'cmp .git/config expect'
+
+git-repo-config Cores.WhatEver Second
+
+cat > expect << EOF
+#
+# This is the config file
+#
+
+[core]
+ penguin = little blue
+ Movie = BadPhysics
+[Cores]
+ WhatEver = Second
+EOF
+
+test_expect_success 'similar section' 'cmp .git/config expect'
+
+git-repo-config CORE.UPPERCASE true
+
+cat > expect << EOF
+#
+# This is the config file
+#
+
+[core]
+ penguin = little blue
+ Movie = BadPhysics
+ UPPERCASE = true
+[Cores]
+ WhatEver = Second
+EOF
+
+test_expect_success 'similar section' 'cmp .git/config expect'
+
+test_expect_success 'replace with non-match' \
+ 'git-repo-config core.penguin kingpin !blue'
+
+test_expect_success 'replace with non-match (actually matching)' \
+ 'git-repo-config core.penguin "very blue" !kingpin'
+
+cat > expect << EOF
+#
+# This is the config file
+#
+
+[core]
+ penguin = very blue
+ Movie = BadPhysics
+ UPPERCASE = true
+ penguin = kingpin
+[Cores]
+ WhatEver = Second
+EOF
+
+test_expect_success 'non-match result' 'cmp .git/config expect'
+
+cat > .git/config << EOF
+[beta] ; silly comment # another comment
+noIndent= sillyValue ; 'nother silly comment
+
+# empty line
+ ; comment
+ haha ="beta" # last silly comment
+haha = hello
+ haha = bello
+[nextSection] noNewline = ouch
+EOF
+
+cp .git/config .git/config2
+
+test_expect_success 'multiple unset' \
+ 'git-repo-config --unset-all beta.haha'
+
+cat > expect << EOF
+[beta] ; silly comment # another comment
+noIndent= sillyValue ; 'nother silly comment
+
+# empty line
+ ; comment
+[nextSection] noNewline = ouch
+EOF
+
+test_expect_success 'multiple unset is correct' 'cmp .git/config expect'
+
+mv .git/config2 .git/config
+
+test_expect_success '--replace-all' \
+ 'git-repo-config --replace-all beta.haha gamma'
+
+cat > expect << EOF
+[beta] ; silly comment # another comment
+noIndent= sillyValue ; 'nother silly comment
+
+# empty line
+ ; comment
+ haha = gamma
+[nextSection] noNewline = ouch
+EOF
+
+test_expect_success 'all replaced' 'cmp .git/config expect'
+
+git-repo-config beta.haha alpha
+
+cat > expect << EOF
+[beta] ; silly comment # another comment
+noIndent= sillyValue ; 'nother silly comment
+
+# empty line
+ ; comment
+ haha = alpha
+[nextSection] noNewline = ouch
+EOF
+
+test_expect_success 'really mean test' 'cmp .git/config expect'
+
+git-repo-config nextsection.nonewline wow
+
+cat > expect << EOF
+[beta] ; silly comment # another comment
+noIndent= sillyValue ; 'nother silly comment
+
+# empty line
+ ; comment
+ haha = alpha
+[nextSection]
+ nonewline = wow
+EOF
+
+test_expect_success 'really really mean test' 'cmp .git/config expect'
+
+test_expect_success 'get value' 'test alpha = $(git-repo-config beta.haha)'
+git-repo-config --unset beta.haha
+
+cat > expect << EOF
+[beta] ; silly comment # another comment
+noIndent= sillyValue ; 'nother silly comment
+
+# empty line
+ ; comment
+[nextSection]
+ nonewline = wow
+EOF
+
+test_expect_success 'unset' 'cmp .git/config expect'
+
+git-repo-config nextsection.NoNewLine "wow2 for me" "for me$"
+
+cat > expect << EOF
+[beta] ; silly comment # another comment
+noIndent= sillyValue ; 'nother silly comment
+
+# empty line
+ ; comment
+[nextSection]
+ nonewline = wow
+ NoNewLine = wow2 for me
+EOF
+
+test_expect_success 'multivar' 'cmp .git/config expect'
+
+test_expect_success 'non-match' \
+ 'git-repo-config --get nextsection.nonewline !for'
+
+test_expect_success 'non-match value' \
+ 'test wow = $(git-repo-config --get nextsection.nonewline !for)'
+
+test_expect_failure 'ambiguous get' \
+ 'git-repo-config --get nextsection.nonewline'
+
+test_expect_success 'get multivar' \
+ 'git-repo-config --get-all nextsection.nonewline'
+
+git-repo-config nextsection.nonewline "wow3" "wow$"
+
+cat > expect << EOF
+[beta] ; silly comment # another comment
+noIndent= sillyValue ; 'nother silly comment
+
+# empty line
+ ; comment
+[nextSection]
+ nonewline = wow3
+ NoNewLine = wow2 for me
+EOF
+
+test_expect_success 'multivar replace' 'cmp .git/config expect'
+
+test_expect_failure 'ambiguous value' 'git-repo-config nextsection.nonewline'
+
+test_expect_failure 'ambiguous unset' \
+ 'git-repo-config --unset nextsection.nonewline'
+
+test_expect_failure 'invalid unset' \
+ 'git-repo-config --unset somesection.nonewline'
+
+git-repo-config --unset nextsection.nonewline "wow3$"
+
+cat > expect << EOF
+[beta] ; silly comment # another comment
+noIndent= sillyValue ; 'nother silly comment
+
+# empty line
+ ; comment
+[nextSection]
+ NoNewLine = wow2 for me
+EOF
+
+test_expect_success 'multivar unset' 'cmp .git/config expect'
+
+test_expect_failure 'invalid key' 'git-repo-config inval.2key blabla'
+
+test_expect_success 'correct key' 'git-repo-config 123456.a123 987'
+
+test_expect_success 'hierarchical section' \
+ 'git-repo-config 1.2.3.alpha beta'
+
+cat > expect << EOF
+[beta] ; silly comment # another comment
+noIndent= sillyValue ; 'nother silly comment
+
+# empty line
+ ; comment
+[nextSection]
+ NoNewLine = wow2 for me
+[123456]
+ a123 = 987
+[1.2.3]
+ alpha = beta
+EOF
+
+test_expect_success 'hierarchical section value' 'cmp .git/config expect'
+
+test_done
+