Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork966
feat: Add support for hasconfig git rule.#2075
feat: Add support for hasconfig git rule.#2075Byron merged 2 commits intogitpython-developers:mainfrombvanelli:2017-support-hasconfig-remote-url
Conversation
Byron left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks so much for contributing this capability!
I really like the implementation, and love that there are tests as well.
To my mind these tests cover the most important cases.
Good to merge!
| elif keyword == "hasconfig:remote.*.url": | ||
| for remote in self._repo.remotes: | ||
| if fnmatch.fnmatchcase(remote.url, value): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Using a case-sensitive search is correct here, Git does the same.
| # Ensure that config with hasconfig and incorrect url is incorrect. | ||
| with open(path1, "w") as stream: | ||
| stream.write(template.format("incorrect", path2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I think that "incorrect" fails to communicate that this is a URL that simply doesn't match.
Maybe something for a follow-up.
0c2bfac intogitpython-developers:mainUh oh!
There was an error while loading.Please reload this page.
bvanelli commentedOct 8, 2025
Oh, such speed, thanks for the quick response! |
Support adding custom paths for the following git config:
According to the documentation:
So I have matched the condition exactly word to word with
hasconfig:remote.*.url. I then go over the list of remotes and find usingfnmatchcasethe correct remote (not sure iffnmatch.Maybe a list of open points here:
Closes#2017