Skip to content
  • Stefan Beller's avatar
    config: fix case sensitive subsection names on writing · 2d84f13d
    Stefan Beller authored and Junio C Hamano's avatar Junio C Hamano committed
    A user reported a submodule issue regarding a section mix-up,
    but it could be boiled down to the following test case:
    
      $ git init test  && cd test
      $ git config foo."Bar".key test
      $ git config foo."bar".key test
      $ tail -n 3 .git/config
      [foo "Bar"]
            key = test
            key = test
    
    Sub sections are case sensitive and we have a test for correctly reading
    them. However we do not have a test for writing out config correctly with
    case sensitive subsection names, which is why this went unnoticed in
    6ae996f2
    
     (git_config_set: make use of the config parser's event
    stream, 2018-04-09)
    
    Unfortunately we have to make a distinction between old style configuration
    that looks like
    
      [foo.Bar]
            key = test
    
    and the new quoted style as seen above. The old style is documented as
    case-agnostic, hence we need to keep 'strncasecmp'; although the
    resulting setting for the old style config differs from the configuration.
    That will be fixed in a follow up patch.
    
    Reported-by: default avatarJP Sugarbroad <jpsugar@google.com>
    Signed-off-by: default avatarStefan Beller <sbeller@google.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    2d84f13d