summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/git.py
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2025-05-15 11:28:32 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-05-15 10:05:49 +0100
commit07f08063c1d6eff52fe95d0b6c1239cb1336c7a7 (patch)
tree562381fa3b163403c9390ad33ea5e42c852f2248 /bitbake/lib/bb/fetch2/git.py
parentd51e9418289b8107eab0bdc74e7d2c2dd0d061cf (diff)
downloadpoky-07f08063c1d6eff52fe95d0b6c1239cb1336c7a7.tar.gz
bitbake: fetch2/git: fix shallow clone for tag containing slash
If a tag contains slash, e.g., debian/5.22, then shallow clone fails because it's using a wrong ref. To reproduce the issue, add the following lines in local.conf: BB_GIT_SHALLOW = "1" BB_GENERATE_SHALLOW_TARBALLS = "1" And then run 'bitbake debianutils -c fetch'. What the original os.path.basename(ref) wanted to do is to remove the strings such as refs/heads/. So we do it explitly to fix this issue. Fixes: [YOCTO #15862] (Bitbake rev: c6d6999f1ed01e7445b8f177a888038edacf555c) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/git.py')
-rw-r--r--bitbake/lib/bb/fetch2/git.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 11cda2007d..784a45bda2 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -639,7 +639,7 @@ class Git(FetchMethod):
639 extra_refs.append(r) 639 extra_refs.append(r)
640 640
641 for ref in extra_refs: 641 for ref in extra_refs:
642 ref_fetch = os.path.basename(ref) 642 ref_fetch = ref.replace('refs/heads/', '').replace('refs/remotes/origin/', '').replace('refs/tags/', '')
643 runfetchcmd("%s fetch origin --depth 1 %s" % (ud.basecmd, ref_fetch), d, workdir=dest) 643 runfetchcmd("%s fetch origin --depth 1 %s" % (ud.basecmd, ref_fetch), d, workdir=dest)
644 revision = runfetchcmd("%s rev-parse FETCH_HEAD" % ud.basecmd, d, workdir=dest) 644 revision = runfetchcmd("%s rev-parse FETCH_HEAD" % ud.basecmd, d, workdir=dest)
645 runfetchcmd("%s update-ref %s %s" % (ud.basecmd, ref, revision), d, workdir=dest) 645 runfetchcmd("%s update-ref %s %s" % (ud.basecmd, ref, revision), d, workdir=dest)