Open tverlaan opened 9 years ago
@tverlaan Thank you for your report! I could imagine the easiest solution would be to do a simple string match like
if "github.com" in "git@github.com:tverlaan/git-passport":
...
I'm not quite sure if it'd be more elegant to find a solution by using urllib
? Because it is related in a way would you like to have a look at this issue: https://github.com/frace/git-passport/issues/28? I could incorporate the changes right in that branch.
That would be indeed the most simple solution. This would also make it possible to have different name/email for github.com:tverlaan and github.com:somethingelse.
I've thought about it. I think pattern matching is the way to go. It will cover more usecases but still allow for string matching.
@tverlaan Could you please give an example?
Well, some domains have multiple TLDs. Instead of listing each TLD (with name and possibly something after the slash, like my name), I want to use a regular expression. Eg.
>>> example = re.match('https://github\.(com|org)/tverlaan','https://github.org/tverlaan')
>>> example.group(0)
'https://github.org/tverlaan'
>>> example = re.match('https://github\.(com|org)/tverlaan','https://github.com/tverlaan')
>>> example.group(0)
'https://github.com/tverlaan'
>>> example = re.match('https://github\.(com|org)/tverlaan','https://github.net/tverlaan')
>>> example.group(0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'group'
>>>
It's maybe not the best example, but you can imagine there are a lot more uses for this.
Ok, I see.
@frace - I see no pull requests have been approved in 18 months. If we submit a PR, can you review and incorporate?
Allow me to bump this up.
Not being able to make the most out of git-passport when using ssh is a bit sad, it'd be lovely to have it merged!
In quite a few cases with my own repositories git-passport doesn't recognize the url correctly. This has to do with the use of urlparse. Some examples:
I can think of two alternatives for fixing this issue:
The first solution would also allow for automatic matching different usernames for different projects with the same base url (say github.com). I'm happy to issue a PR, but I wanted to discuss first.