Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[RFC] new git_config enumeration API #1409

Closed
@cholin

Description

@cholin

Hey,

regarding extending libgit2 with non-callback-based iterators (#1384) I looked at git_config_foreach. It seems that it's not that trivial (in comparison to git_notes) because here we need changes deep in the code. I think foreach should be replaced in general in git_config_backend. As @arrbee suggested in libgit2/pygit2#183 with a new enumeration api, libgit2 could benefit as well in moving backend code to common code. I had something like the following for the backend struct in mind:

struct git_config_backend {
  unsigned int version;
  struct git_config *cfg;
  int (*open) ...
  int (*get) ..
  int (*set) ...
  int (*del) ...
  int (*refresh) ..
  int (*free) ...
  int (*iterator) ... // initializes iterator
  int (*next) ...     // returns the next entry in iterator
}

With this it's may be possible to get rid of the pattern matching functions in the low level backend and implement them one abstraction layer above with help of the iterator functions. The current default backend (built on top of khash) supports with khiter as well classic enumeration. What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions