diff mbox series

fetch2/git: Only fetch extra shallow refs that exist

Message ID 20260620174416.1489364-1-pkj@axis.com
State New
Headers show
Series fetch2/git: Only fetch extra shallow refs that exist | expand

Commit Message

Peter Kjellerstedt June 20, 2026, 5:44 p.m. UTC
When using BB_GIT_SHALLOW_EXTRA_REFS in combination with a recipe that
fetches multiple URLs, make sure to only fetch the references that exist
in the respective remote repositories.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 lib/bb/fetch2/git.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 0fbd85441..3f723ca62 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -640,7 +640,7 @@  class Git(FetchMethod):
             if '*' in r:
                 matches = filter(lambda a: fnmatch.fnmatchcase(a, r), all_refs)
                 extra_refs.extend(matches)
-            else:
+            elif r in all_refs:
                 extra_refs.append(r)
 
         for ref in extra_refs: