feat: Add support for hasconfig git rule. by bvanelli · Pull Request #2075 · gitpython-developers/GitPython

Support adding custom paths for the following git config:

# Anonymous user override
[includeIf "hasconfig:remote.*.url:**/**github.com*/**"]
	path = ~/.personal.gitconfig

According to the documentation:

As for the naming of this keyword, it is for forwards compatibility with a naming scheme that supports more variable-based include conditions, but currently Git only supports the exact keyword described above.

So I have matched the condition exactly word to word with hasconfig:remote.*.url. I then go over the list of remotes and find using fnmatchcase the correct remote (not sure if fnmatch.

Maybe a list of open points here:

  • I'm not sure if the wildcard format and the fnmatch function are equivalent. Is it necessary to match these two 100%? Maybe a maintainer would have more experience with
  • Should I write more test cases?
  • Write a couple of cases which are handled by both git binary and gitpython and compare the two.

Closes #2017