Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion passport/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
14 changes: 10 additions & 4 deletions passport/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,25 @@ def config_set(config, value, property):
Exception: If subprocess.Popen() fails
"""
try:
subprocess.Popen([
git_process = subprocess.Popen([
"git",
"config",
"--local",
"user." + 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.
Expand Down