feat: improved git error messages

master 3.7.2.13
idziubenko 2 years ago
parent 11fbb3c4a6
commit 1d67c92811

@ -116,8 +116,8 @@ class Git():
match = cls.re_url.match(url)
if not match:
return None
if match.group(2) and not match.group(3):
url = "git://%s" % match.group(2)
if match.group(3) and not match.group(2):
url = "https://%s" % match.group(3)
else:
url = match.group(1)
return "%s.git" % url
@ -284,9 +284,13 @@ class Git():
if not res:
if error:
self.detect_error(error, url)
raise GitError(
_("Reference {mark} not found in repository {url}"
).format(mark=reference, url=url))
raise GitError(
_("Git encountered an error: {error}"
).format(error=str(error[-1])))
else:
raise GitError(
_("Reference {mark} not found in repository {url}"
).format(mark=reference, url=url))
return res
# получить последние коммиты из удаленного репозитория
@ -436,9 +440,13 @@ class Git():
if not res:
if error:
self.detect_error(error, url)
raise GitError(
_("Reference {mark} not found in repository {url}").format(
mark=reference, url=url))
raise GitError(
_("Git encountered an error: {error}"
).format(error=str(error[-1])))
else:
raise GitError(
_("Reference {mark} not found in repository {url}").format(
mark=reference, url=url))
res = command("reset", "--hard", "FETCH_HEAD", part=4, startpart=3)
if not res:
if self._clear_lock(git_dir, "index.lock", error):

Loading…
Cancel
Save