summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--morphlib/plugins/get_repo_plugin.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/morphlib/plugins/get_repo_plugin.py b/morphlib/plugins/get_repo_plugin.py
index 9c1c19f1..c1cb6d0e 100644
--- a/morphlib/plugins/get_repo_plugin.py
+++ b/morphlib/plugins/get_repo_plugin.py
@@ -107,7 +107,11 @@ class GetRepoPlugin(cliapp.Plugin):
try:
self._clone_repo(cached_repo, dirname,
- ref or chunk_spec['ref'])
+ ref or chunk_spec['ref'])
+ except morphlib.gitdir.InvalidRefError:
+ raise cliapp.AppException(
+ "Cannot get '%s', repo has no commit at ref %s."
+ % (chunk_spec['name'], ref or chunk_spec['ref']))
except BaseException as e:
logging.debug('Removing %s due to %s', dirname, e)
shutil.rmtree(dirname)