diff --git a/passport/case.py b/passport/case.py index e7f779e..0270c19 100644 --- a/passport/case.py +++ b/passport/case.py @@ -76,7 +76,16 @@ def gen_candidates(ids, url): yield (key, value) local_passports = config["git_passports"] - netloc = urllib.parse.urlparse(url)[1] + + # For a lot of SSH git clones the scheme is implicit in the URLs provided to + # copy-paste from the website (ie. git@github.com:project/name.git) - + # without the explicit ssh:// on the front urllib doesn't play nice with + # the URL + parsedurl = urllib.parse.urlparse(url) + if parsedurl.hostname == None: + parsedurl = urllib.parse.urlparse("ssh://" + url) + + netloc = parsedurl.hostname candidates = dict(gen_candidates(local_passports, netloc)) diff --git a/passport/git.py b/passport/git.py index 9a1a4b3..5c482ff 100644 --- a/passport/git.py +++ b/passport/git.py @@ -86,7 +86,7 @@ def config_set(config, value, property): Exception: If subprocess.Popen() fails """ try: - subprocess.Popen([ + git_process = subprocess.Popen([ "git", "config", "--local", @@ -94,11 +94,17 @@ def config_set(config, value, property): value ], stdout=subprocess.PIPE) - except Exception: - raise + # Captures the git return code + exit_status = git_process.wait() - return True + if exit_status == 0: + return True + else: + return False + + except Exception: + raise def config_remove(verbose=True): """ Remove an existing Git identity.