diff mbox series

Fall back to non-annotated tags for pull requests

Message ID 20231114042835.48432-1-superm1@gmail.com (mailing list archive)
State Accepted
Headers show
Series Fall back to non-annotated tags for pull requests | expand

Commit Message

Mario Limonciello Nov. 14, 2023, 4:28 a.m. UTC
Not everyone uses an annotated tag, so fallback to a direct ref
tag if annotated tags fail.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 b4/pr.py | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Konstantin Ryabitsev Jan. 23, 2024, 11:04 p.m. UTC | #1
On Mon, 13 Nov 2023 22:28:35 -0600, Mario Limonciello wrote:
> Not everyone uses an annotated tag, so fallback to a direct ref
> tag if annotated tags fail.
> 
> 

Applied, thanks!

[1/1] Fall back to non-annotated tags for pull requests
      commit: dc0c5559df0ba626dd42d4fe144419585ea609ba

Best regards,
diff mbox series

Patch

diff --git a/b4/pr.py b/b4/pr.py
index 6c01e2b..e62690b 100644
--- a/b4/pr.py
+++ b/b4/pr.py
@@ -71,7 +71,11 @@  def git_get_commit_id_from_repo_ref(repo, ref):
             lines = b4.git_get_command_lines(None, ['ls-remote', repo, 'refs/tags/%s^{}' % ref])
 
     elif ref.find('tags/') == 0:
+        #try as an annotated tag first
         lines = b4.git_get_command_lines(None, ['ls-remote', repo, 'refs/%s^{}' % ref])
+        if not lines:
+            # try it as a non-annotated tag, then
+            lines = b4.git_get_command_lines(None, ['ls-remote', repo, 'refs/%s' % ref])
 
     else:
         # Grab it as a head and hope for the best