Skip to content

Commit

Permalink
show both commit ids in error message on tag commit mismatch
Browse files Browse the repository at this point in the history
In case both a tag and a commit is specified, kas checks if the tag
actually points to the commit. On mismatch, only the wanted commit id
was shown but not the actual one. Now we show both so that the user can
inspect the incorrect one as well.

Signed-off-by: Felix Moessbauer <[email protected]>
Signed-off-by: Jan Kiszka <[email protected]>
  • Loading branch information
fmoessbauer authored and jan-kiszka committed Jan 7, 2025
1 parent c397a98 commit e7516cb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions kas/repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,12 +418,13 @@ def checkout(self):
raise RepoRefError(f'Tag "{self.tag}" cannot be found '
f'in repository "{self.name}"')

if self.commit and output.strip() != self.commit:
desired_ref = output.strip()
if self.commit and desired_ref != self.commit:
# Ensure provided commit and tag match
raise RepoRefError(f'Provided tag "{self.tag}" does not match '
raise RepoRefError(f'Provided tag "{self.tag}" '
f'("{desired_ref}") does not match '
f'provided commit "{self.commit}" in '
f'repository "{self.name}", aborting!')
desired_ref = output.strip()
is_branch = False
elif self.branch:
(retc, output) = run_cmd(self.resolve_branch_cmd(),
Expand Down

0 comments on commit e7516cb

Please sign in to comment.