Skip to content

Commit

Permalink
Fix Repo.revision when using tag
Browse files Browse the repository at this point in the history
Repo.revision() was returning self.tag instead of the corresponding commit
This patch fixes this by calling Repo.resolve_tag_cmd().

Signed-off-by: Félix Piédallu <[email protected]>
Signed-off-by: Jan Kiszka <[email protected]>
  • Loading branch information
Salamandar authored and jan-kiszka committed Dec 11, 2023
1 parent 3ecb52c commit 1e19842
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions kas/repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,19 @@ def revision(self):
if self.commit:
return self.commit
if self.tag:
(_, output) = run_cmd(self.resolve_tag_cmd(),
cwd=self.path, fail=False)
if output:
return output.strip()
return self.tag
branch = self.branch or self.refspec
if not branch:
return None
(_, output) = run_cmd(self.resolve_branch_cmd(),
cwd=self.path, fail=False)
if output:
return output.strip()
return branch
if branch:
(_, output) = run_cmd(self.resolve_branch_cmd(),
cwd=self.path, fail=False)
if output:
return output.strip()
return branch
return None

def __str__(self):
if self.commit and (self.tag or self.branch):
Expand Down

0 comments on commit 1e19842

Please sign in to comment.