From d573036997d2000e623c90f0c646950a8633f611 Mon Sep 17 00:00:00 2001 From: no92 Date: Fri, 10 Jun 2022 02:03:40 +0200 Subject: [PATCH] vcs: print error message with context when checkout fails --- xbstrap/base.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/xbstrap/base.py b/xbstrap/base.py index db4c578..c54ea82 100644 --- a/xbstrap/base.py +++ b/xbstrap/base.py @@ -2086,10 +2086,15 @@ def checkout_src(cfg, src, settings): if fixed_commit is not None: commit = fixed_commit if init or settings.reset != ResetMode.NONE: - subprocess.check_call( - ["git", "checkout", "--no-track", "-B", source["branch"], commit], - cwd=src.source_dir, - ) + try: + subprocess.check_call( + ["git", "checkout", "--no-track", "-B", source["branch"], commit], + cwd=src.source_dir, + ) + except subprocess.CalledProcessError: + raise GenericError( + "git checkout of '{}' failed for source '{}'".format(commit, src.name) + ) subprocess.call( ["git", "branch", "-u", "refs/remotes/origin/" + source["branch"]], cwd=src.source_dir,