Skip to content

Commit

Permalink
fix(checkout): Properly handle if we cannot retrieve tip of tree
Browse files Browse the repository at this point in the history
In some cases (typo/mistake) we cannot retrieve commit id, we
must generate proper error that will hint what might be the reason.

Signed-off-by: Denys Fedoryshchenko <[email protected]>
  • Loading branch information
nuclearcat committed Dec 9, 2024
1 parent 46a699d commit 6855788
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions kcidev/subcommands/checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ def checkout(
f"Retrieving latest commit on tree: {giturl} branch: {branch}", fg="green"
)
commit = retrieve_tot_commit(giturl, branch)
if not commit or len(commit) != 40:
click.secho(
"Unable to retrieve latest commit. Wrong tree/branch?", fg="red"
)
return
click.secho(f"Commit to checkout: {commit}", fg="green")
resp = send_checkout_full(
url,
Expand Down

0 comments on commit 6855788

Please sign in to comment.