Skip to contentSkip to conversation

Fall back to non-annotated tags for pull requests

PATCH Applied Mario Limonciello 2 participants 2 messages Nov 14, 2023 – Jan 23, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fall back to non-annotated tags for pull requests

Not everyone uses an annotated tag, so fallback to a direct ref tag if annotated tags fail.

---
 b4/pr.py | 4 ++++
 1 file changed, 4 insertions(+)
b4/pr.py +4 -0
index 6c01e2b..e62690b 100644
@@ -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
Signature · 1 line
2.41.0
#1 lore raw
Quoted 4 lines · Mario Limonciello

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,

Signature · 1 line
Konstantin Ryabitsev <[email protected]>