Skip to content

Commit

Permalink
vcs: print error message with context when checkout fails
Browse files Browse the repository at this point in the history
  • Loading branch information
no92 committed Aug 9, 2023
1 parent 25dc78f commit d573036
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions xbstrap/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d573036

Please sign in to comment.