Skip to content

Commit

Permalink
checkout: check whether commit exists and warn if it doesn't
Browse files Browse the repository at this point in the history
  • Loading branch information
no92 committed Jan 23, 2023
1 parent c0bf146 commit f9c2b64
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions xbstrap/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2086,6 +2086,18 @@ def checkout_src(cfg, src, settings):
else:
if fixed_commit is not None:
commit = fixed_commit
missing_commit = False
try:
subprocess.check_call(
["git", "cat-file", "-e", commit + "^{commit}"],
cwd=src.source_dir,
)
except subprocess.CalledProcessError:
missing_commit = True
if missing_commit:
raise RuntimeError(
"git commit '{}' was not found for source '{}'".format(commit, src.name)
)
if init or settings.reset != ResetMode.NONE:
subprocess.check_call(
["git", "checkout", "--no-track", "-B", source["branch"], commit],
Expand Down

0 comments on commit f9c2b64

Please sign in to comment.