git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] config: arbitrary number of matches for --unset and --replace-all

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Nov 13, 2013, 23:22 UTC
Message-ID
<CAPig+cQZo0R3q=J2BygTfdJ1uuiT1HPDCjTxt8mykxOXM1uf2Q@mail.gmail.com>
In-Reply-To
<06ba1524cbe4fa31b6e1a8d644882521aeaff4f4.1384337608.git.tr@thomasrast.ch>
On Wed, Nov 13, 2013 at 5:19 AM, Thomas Rast <tr@thomasrast.ch> wrote:
Show 17 quoted lines
> diff --git a/t/t1303-wacky-config.sh b/t/t1303-wacky-config.sh
> index 46103a1..7d55730 100755
> --- a/t/t1303-wacky-config.sh
> +++ b/t/t1303-wacky-config.sh
> @@ -47,4 +58,57 @@ test_expect_success 'do not crash on special long config line' '
>         check section.key "$LONG_VALUE"
>  '
>
> +setup_many() {
> +       setup &&
> +       # This time we want the newline so that we can tack on more
> +       # entries.
> +       echo >>.git/config &&
> +       # Semi-efficient way of concatenating 5^5 = 3125 lines. Note
> +       # that because 'setup' already put one line, this means 3126
> +       # entries for section.key in the config file.
> +       cat >5to1 <<EOF
Broken &&-chain.
Show 47 quoted lines
> +  key = foo
> +  key = foo
> +  key = foo
> +  key = foo
> +  key = foo
> +EOF
> +       cat 5to1 5to1 5to1 5to1 5to1 >5to2 &&      # 25
> +       cat 5to2 5to2 5to2 5to2 5to2 >5to3 &&      # 125
> +       cat 5to3 5to3 5to3 5to3 5to3 >5to4 &&      # 635
> +       cat 5to4 5to4 5to4 5to4 5to4 >>.git/config # 3125
> +}
> +
> +test_expect_success 'get many entries' '
> +       setup_many &&
> +       git config --get-all section.key >actual &&
> +       test_line_count = 3126 actual
> +'
> +
> +test_expect_success 'get many entries by regex' '
> +       setup_many &&
> +       git config --get-regexp "sec.*ke." >actual &&
> +       test_line_count = 3126 actual
> +'
> +
> +test_expect_success 'add and replace one of many entries' '
> +       setup_many &&
> +       git config --add section.key bar &&
> +       check_regex section.key "b.*r" bar &&
> +       git config section.key beer "b.*r" &&
> +       check_regex section.key "b.*r" beer
> +'
> +
> +test_expect_success 'replace many entries' '
> +       setup_many &&
> +       git config --replace-all section.key bar &&
> +       check section.key bar
> +'
> +
> +test_expect_success 'unset many entries' '
> +       setup_many &&
> +       git config --unset-all section.key &&
> +       test_must_fail git config section.key
> +'
> +
>  test_done
> --
> 1.8.5.rc0.346.g150976e
Previous: Thomas RastNext: Thomas Rast
Message 3 of 8 in “Bug with git svn fetch? "error:too many matches for svn-remote.svn.added-placeholder"”
  1. Jess HottensteinNov 5, 2013
  2. config: arbitrary number of matches for --unset and --replace-allThomas Rast, Nov 13, 2013
  3. Eric SunshineNov 13, 2013
  4. config: arbitrary number of matches for --unset and --replace-allThomas Rast, Nov 14, 2013
  5. Jeff KingNov 14, 2013
  6. Thomas RastNov 14, 2013
  7. fixup! config: arbitrary number of matches for --unset and --replace-allJunio C Hamano, Dec 6, 2013
  8. Jeff KingDec 6, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.