From 7233b80200db7c21383f993e3608878d36c3f397 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Thu, 8 Feb 2024 17:23:01 +0100 Subject: [PATCH] lib/libnetwork.lib.in: make sure requested commit to checkout exists or fail --- lib/libnetwork.lib.in | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/libnetwork.lib.in b/lib/libnetwork.lib.in index afcc9b5..673332a 100644 --- a/lib/libnetwork.lib.in +++ b/lib/libnetwork.lib.in @@ -980,6 +980,9 @@ function git.create_tarball() { if [ "${git_branch/@*}" != "${git_branch}" ]; then git_commit="${git_branch/*@}" git_branch="${git_branch/@*}" + if [ ! "${git_commit}" ]; then + notify.error "$FUNCNAME: cannot checkout empty commit" + fi fi notify.debug "$FUNCNAME: git_branch = \"$git_branch\"" if [ "${git_commit}" ]; then @@ -1053,7 +1056,11 @@ not the expected package version"" (${NOTE}${today}git${NORM})..." if [ "${git_commit}" ]; then cd ${pck_tarball} - git checkout ${git_commit} + git checkout ${git_commit} || { + popd &>/dev/null + rm -fr $tmpgitdir + notify.error $"cannot checkout the specified tag"; + } cd .. fi