Skip to content

Commit 5db267b

Browse files
committed
Fixed test
1 parent c06aa2c commit 5db267b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/poetry/vcs/git/backend.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,8 @@ def _clone(cls, url: str, refspec: GitRefSpec, target: Path) -> Repo:
314314
if isinstance(e, AssertionError) and "Invalid object name" not in str(e):
315315
raise
316316

317+
short_ref_found = False
318+
317319
if refspec.is_sha_short:
318320
commit = cls._find_object_by_sha_prefix(local, refspec.key.encode())
319321
if commit is not None:
@@ -326,6 +328,7 @@ def _clone(cls, url: str, refspec: GitRefSpec, target: Path) -> Repo:
326328
try:
327329
with local:
328330
local.reset_index()
331+
short_ref_found = True
329332
except (AssertionError, KeyError) as e:
330333
logger.debug(
331334
"\nRequested ref (<c2>%s</c2>) was not fetched to local copy and"
@@ -335,10 +338,11 @@ def _clone(cls, url: str, refspec: GitRefSpec, target: Path) -> Repo:
335338
e,
336339
)
337340

338-
raise PoetryConsoleError(
339-
f"Failed to clone {url} at '{refspec.key}', verify ref exists on"
340-
" remote."
341-
)
341+
if not short_ref_found:
342+
raise PoetryConsoleError(
343+
f"Failed to clone {url} at '{refspec.key}', verify ref exists on"
344+
" remote."
345+
)
342346

343347
return local
344348

0 commit comments

Comments
 (0)