GitPython icon indicating copy to clipboard operation
GitPython copied to clipboard

GitConfigParser.items doesn't @need_value (i.e. requires a prior call to .read() )

Open maiamcc opened this issue 6 years ago • 1 comments

  • a call to GitConfigParser.items("somesection") fails with NoSectionError even when "somesection" exists.
  • however, with a prior call to GitConfigParser.sections() OR .get_value() -- as far as I can tell, anything that trips assure_data_present -- the call to items("somesection") succeeds

I'm not quite sure what's going on under the hood here, but my understanding after poking through the source code a bit:

GitConfigParser.items is not marked with a @needs_values decorator, nor is it a base class method (automatically decorated in MetaParserBuilder.__new__), nor does it call to a base class method with this decorator (as .get_value does) -- without a prior call to a func decorated with @needs_values (or some other call to read()), I assume that .items will always fail. Is this intentional?

maiamcc avatar Jul 03 '19 00:07 maiamcc

Thanks for the precise description and for digging in.

To me it sounds like an oversight, too. Recently the config parser was upgraded to support multiple values, it may be it learned some tricks and became more ergonomic. I hope to publish a new release this weekend.

Byron avatar Jul 20 '19 12:07 Byron