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

Re: [PATCH] make config --add behave correctly for empty and NULL values

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Aug 18, 2014, 12:33 UTC
Message-ID
<vpq61hqc6z4.fsf@anie.imag.fr>
In-Reply-To
<1408357077-4745-1-git-send-email-tanayabh@gmail.com>
Tanay Abhra <tanayabh@gmail.com> writes:
Show 17 quoted lines
> Currently if we have a config file like,
> [foo]
>         baz
>         bar =
>
> and we try something like, "git config --add foo.baz roll", Git will
> segfault. Moreover, for "git config --add foo.bar roll", it will
> overwrite the original value instead of appending after the existing
> empty value.
>
> The problem lies with the regexp used for simulating --add in
> `git_config_set_multivar_in_file()`, "^$", which in ideal case should
> not match with any string but is true for empty strings. Instead use a
> regexp like "a^" which can not be true for any string, empty or not.
>
> For removing the segfault add a check for NULL values in `matches()` in
> config.c.

I would have prefered two separate patches (or even better, 3, the first one being "demonstrate failure of ..." with test_expect_failure) for each issues.

But the fixes are straightforward, and the test actually test what it has to test, so I think we can keep the patch as-is.

Thanks,
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Tanay AbhraNext: Junio C Hamano
Message 2 of 12 in “make config --add behave correctly for empty and NULL values”
  1. make config --add behave correctly for empty and NULL valuesTanay Abhra, Aug 18, 2014
  2. Matthieu MoyAug 18, 2014
  3. Junio C HamanoAug 18, 2014
  4. Jeff KingAug 19, 2014
  5. Junio C HamanoAug 19, 2014
  6. Jeff KingAug 19, 2014
  7. Junio C HamanoSep 11, 2014
  8. Jeff KingSep 12, 2014
  9. 1/2 document irregular config --add behaviour for empty and NULL valuesTanay Abhra, Sep 12, 2014
  10. 2/2 make config --add behave correctly for empty and NULL valuesTanay Abhra, Sep 12, 2014
  11. Matthieu MoySep 12, 2014
  12. Junio C HamanoSep 12, 2014

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.