From 685578867267bfdb7f0817ec67c6c1df2aec44f5 Mon Sep 17 00:00:00 2001 From: Denys Fedoryshchenko Date: Mon, 9 Dec 2024 13:52:03 +0200 Subject: [PATCH] fix(checkout): Properly handle if we cannot retrieve tip of tree 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 --- kcidev/subcommands/checkout.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kcidev/subcommands/checkout.py b/kcidev/subcommands/checkout.py index cf8c6c3..ac21adf 100644 --- a/kcidev/subcommands/checkout.py +++ b/kcidev/subcommands/checkout.py @@ -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,