Skip to content
  • René Scharfe's avatar
    parse-options: make CMDMODE errors more precise · 0025dde7
    René Scharfe authored and Junio C Hamano's avatar Junio C Hamano committed
    Only a single PARSE_OPT_CMDMODE option can be specified for the same
    variable at the same time.  This is enforced by get_value(), but the
    error messages are imprecise in three ways:
    
    1. If a non-PARSE_OPT_CMDMODE option changes the value variable of a
    PARSE_OPT_CMDMODE option then an ominously vague message is shown:
    
       $ t/helper/test-tool parse-options --set23 --mode1
       error: option `mode1' : incompatible with something else
    
    Worse: If the order of options is reversed then no error is reported at
    all:
    
       $ t/helper/test-tool parse-options --mode1 --set23
       boolean: 0
       integer: 23
       magnitude: 0
       timestamp: 0
       string: (not set)
       abbrev: 7
       verbose: -1
       quiet: 0
       dry run: no
       file: (not set)
    
    Fortunately this can currently only happen in the test helper; actual
    Git commands don't share the same variable for the value of options with
    and without the flag PARSE_OPT_CMDMODE.
    
    2. If there are multiple options with the same value (synonyms),...
    0025dde7