<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>14156</bug_id>
          
          <creation_ts>2020-12-18 10:55:20 +0000</creation_ts>
          <short_desc>fetch/gitsm: submodules are checked out as mirrors with altered origin information</short_desc>
          <delta_ts>2025-07-18 08:40:36 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>BitBake</product>
          <component>bitbake</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>5.99</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="bojan">bojan.milosevic.work</reporter>
          <assigned_to name="Unassigned">unassigned</assigned_to>
          <cc>akuster</cc>
    
    <cc>bojan.milosevic.work</cc>
    
    <cc>niqingliang2003</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>88795</commentid>
    <comment_count>0</comment_count>
    <who name="bojan">bojan.milosevic.work</who>
    <bug_when>2020-12-18 10:55:20 +0000</bug_when>
    <thetext>The gitsm fetcher handling git repos with submodules does not work as expected, since the submodules are fetched as mirrored. 

When using gitsm in a recipe, the git repo and submodules will be correctly fetched at the requested revision.

The main git is ok and will correctly show the current commit and all the branches on origin and it will allow for further interaction (fetch, checkout commits/branches, commit, push).

A submodule git will be checked out as a mirror, hence it will show only local branches up to the one fetched, it will not have correct references for origin. It will not allow for further interaction with the git repo: no fetch, no pulling/checking out remote branches and no push of new commits.

This is a major issue for our workflow, since we use several projects with submodules (including in the kernel on some projects) and we need to work on them both within a yocto build and from outside yocto.

This behavior was not present on sumo, but I found it on zeus. I&apos;ve performed some tests as reported below. I&apos;m currently comparing sumo and zeus because they are included in the vendor&apos;s BSP releases we are working on.

To test/reproduce the behavior I used the git-submodule-test recipe and its git repo which contains recursive submodules (the recursive part is not of interest here, the behavior is the same with a single submodule). between tests I&apos;ve deleted the build dir to have a clean build each time.

Below you can find the resulting git config in different cases:
1) manually cloning the repo -&gt; OK
2) using poky master -&gt; FAIL
3) using poky zeus -&gt; FAIL
4) using poky sumo -&gt; OK

my knowledge of git is limited, but I&apos;ve identified the differences as that in cases (2) and (3) the main git has the submodules not set as active and the submodule git config has 
remote.origin.fetch=+refs/*:refs/*
remote.origin.mirror=true

I also tested copying the gitsm.py file from sumo to zeus and it works fine, so I&apos;m using that as a workaround at the moment.

##########################################################################
Locally cloned git repo

$ git clone https://git.yoctoproject.org/git/git-submodule-test
$ cd git-submodule-test
$ git submodule update --init --recursive
$ git config --list
http.sslcainfo=/etc/ssl/certs/ca-certificates.crt
color.ui=auto
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=https://git.yoctoproject.org/git/git-submodule-test
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
submodule.bitbake.active=true
submodule.bitbake.url=git://git.openembedded.org/bitbake
submodule.bitbake-gitsm-test1.active=true
submodule.bitbake-gitsm-test1.url=git://git.yoctoproject.org/bitbake-gitsm-test1

$ cd bitbake
$ git config --list
http.sslcainfo=/etc/ssl/certs/ca-certificates.crt
color.ui=auto
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.worktree=../../../bitbake
remote.origin.url=git://git.openembedded.org/bitbake
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master


##########################################################################
Yocto master
Commit: 38b45cd73eb360ce6dbe441ea497044acd27d777

$ git clone git://git.yoctoproject.org/poky poky_test
$ cd poky_test
$ . oe-init-build-env
&gt;&gt; add layer meta-selftest and re-run init script
$ bitbake git-submodule-test
$ cd tmp/work/core2-64-poky-linux/git-submodule-test/1.0-r0/git
$ git config --list
http.sslcainfo=/etc/ssl/certs/ca-certificates.crt
color.ui=auto
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=git://git.yoctoproject.org/git-submodule-test
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
submodule.bitbake.url=/media/hddata/GitLab/tmp/external/poky_test/build/downloads/git2/git.openembedded.org.bitbake
submodule.bitbake-gitsm-test1.url=/media/hddata/GitLab/tmp/external/poky_test/build/downloads/git2/git.yoctoproject.org.bitbake-gitsm-test1

$ cd bitbake
$ git config --list
http.sslcainfo=/etc/ssl/certs/ca-certificates.crt
color.ui=auto
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.worktree=../../../bitbake
remote.origin.url=git://git.openembedded.org/bitbake
remote.origin.fetch=+refs/*:refs/*
remote.origin.mirror=true


##########################################################################
Yocto zeus
Commit: d88d62c20d7d8da85f02edb170dae0280624ad7e

$ git clone git://git.yoctoproject.org/poky poky_test
$ cd poky_test
$ . oe-init-build-env
&gt;&gt; add recipe git-submodule-test taken from yocto master
&gt;&gt; add layer meta-selftest and re-run init script
$ bitbake git-submodule-test
$ cd tmp/work/core2-64-poky-linux/git-submodule-test/1.0-r0/git
$ git config --list
http.sslcainfo=/etc/ssl/certs/ca-certificates.crt
color.ui=auto
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=git://git.yoctoproject.org/git-submodule-test
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
submodule.bitbake.url=/media/hddata/GitLab/tmp/external/poky_test/build/downloads/git2/git.openembedded.org.bitbake
submodule.bitbake-gitsm-test1.url=/media/hddata/GitLab/tmp/external/poky_test/build/downloads/git2/git.yoctoproject.org.bitbake-gitsm-test1

$ cd bitbake
$ git config --list
http.sslcainfo=/etc/ssl/certs/ca-certificates.crt
color.ui=auto
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.worktree=../../../bitbake
remote.origin.url=git://git.openembedded.org/bitbake
remote.origin.fetch=+refs/*:refs/*
remote.origin.mirror=true


##########################################################################
Yocto sumo
Commit: b39f4146de84d7b36861859ec669d9c8e2ca77c6

$ git clone git://git.yoctoproject.org/poky poky_test
$ cd poky_test
$ . oe-init-build-env
&gt;&gt; add layer meta-selftest
$ bitbake git-submodule-test
$ cd tmp/work/core2-64-poky-linux/git-submodule-test/1.0-r0/git
$ git config --list
http.sslcainfo=/etc/ssl/certs/ca-certificates.crt
color.ui=auto
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=git://git.yoctoproject.org/git-submodule-test
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
submodule.bitbake.active=true
submodule.bitbake.url=git://git.openembedded.org/bitbake
submodule.bitbake-gitsm-test1.active=true
submodule.bitbake-gitsm-test1.url=git://git.yoctoproject.org/bitbake-gitsm-test1

$ cd bitbake
$ git config --list
http.sslcainfo=/etc/ssl/certs/ca-certificates.crt
color.ui=auto
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.worktree=../../../bitbake
remote.origin.url=git://git.openembedded.org/bitbake
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88813</commentid>
    <comment_count>1</comment_count>
    <who name="Armin Kuster">akuster</who>
    <bug_when>2020-12-24 18:39:38 +0000</bug_when>
    <thetext>bojan,

Thank you for all the detail.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88814</commentid>
    <comment_count>2</comment_count>
    <who name="Armin Kuster">akuster</who>
    <bug_when>2020-12-24 18:40:00 +0000</bug_when>
    <thetext>triaging</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95076</commentid>
    <comment_count>3</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2023-03-07 13:53:44 +0000</bug_when>
    <thetext>Just to summarise, the issue as reported is that the repository origin information isn&apos;t the same as a direct clone of the repository. Due to the way the fetcher mirrors and checks out data for speed, this isn&apos;t really surprising.

The question is whether we could/should be updating and reconfiguring the checkout to match a standard clone and I don&apos;t have an answer on that. It isn&apos;t something we&apos;ve guaranteed to do so not a bug as such.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97133</commentid>
    <comment_count>4</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-10-30 15:37:29 +0000</bug_when>
    <thetext>Build move to 5.0 -- ../Randy</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98837</commentid>
    <comment_count>5</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-04-25 01:13:55 +0000</bug_when>
    <thetext>Bulk move of 5.0 medium importance issues to 5.99.
Move to 5.1 if you want to actively work on an issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98869</commentid>
    <comment_count>6</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-04-25 01:23:12 +0000</bug_when>
    <thetext>Move to 5.99 since no one is actively working on this issue.
Move to 5.x if you start on a task, please.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102485</commentid>
    <comment_count>7</comment_count>
    <who name="niqingliang2003">niqingliang2003</who>
    <bug_when>2025-07-18 08:40:36 +0000</bug_when>
    <thetext>main repo of gitsm can&apos;t work on local git mirror, 

PREMIRROR setting:
git://.*/.*     git:///mnt/datum/repositories/HOST/PATH;protocol=file \
gitsm://.*/.*     git:///mnt/datum/repositories/HOST/PATH;protocol=file \

expected is:
git:///mnt/datum/repositories/github.com/libjxl/libjxl.git;protocol=file

but poky want:
git:///mnt/datum/repositories/github.com/libjxl/git2_github.com.libjxl.libjxl.git.tar.gz;protocol=file

DEBUG: For url [&apos;gitsm&apos;, &apos;github.com&apos;, &apos;/libjxl/libjxl.git&apos;, &apos;&apos;, &apos;&apos;, OrderedDict({&apos;protocol&apos;: &apos;https&apos;, &apos;nobranch&apos;: &apos;1&apos;})] comparing [&apos;git&apos;, &apos;.*&apos;, &apos;/.*&apos;, &apos;&apos;, &apos;&apos;, OrderedDict()] to [&apos;git&apos;, &apos;&apos;, &apos;/mnt/datum/repositories/HOST/PATH&apos;, &apos;&apos;, &apos;&apos;, OrderedDict({&apos;protocol&apos;: &apos;file&apos;})]
DEBUG: For url [&apos;gitsm&apos;, &apos;github.com&apos;, &apos;/libjxl/libjxl.git&apos;, &apos;&apos;, &apos;&apos;, OrderedDict({&apos;protocol&apos;: &apos;https&apos;, &apos;nobranch&apos;: &apos;1&apos;})] comparing [&apos;gitsm&apos;, &apos;.*&apos;, &apos;/.*&apos;, &apos;&apos;, &apos;&apos;, OrderedDict()] to [&apos;git&apos;, &apos;&apos;, &apos;/mnt/datum/repositories/HOST/PATH&apos;, &apos;&apos;, &apos;&apos;, OrderedDict({&apos;protocol&apos;: &apos;file&apos;})]
DEBUG: For url gitsm://github.com/libjxl/libjxl.git;protocol=https;nobranch=1 returning git:///mnt/datum/repositories/github.com/libjxl/git2_github.com.libjxl.libjxl.git.tar.gz;protocol=file
DEBUG: Mirror fetch failure for url git:///mnt/datum/repositories/github.com/libjxl/git2_github.com.libjxl.libjxl.git.tar.gz;protocol=file (original url: gitsm://github.com/libjxl/libjxl.git;protocol=https;nobranch=1)
DEBUG: URL: &apos;git:///mnt/datum/repositories/github.com/libjxl/git2_github.com.libjxl.libjxl.git.tar.gz;protocol=file&apos; has invalid parameters. The url does not set any branch parameter or set nobranch=1.
DEBUG: For url [&apos;gitsm&apos;, &apos;github.com&apos;, &apos;/libjxl/libjxl.git&apos;, &apos;&apos;, &apos;&apos;, OrderedDict({&apos;protocol&apos;: &apos;https&apos;, &apos;nobranch&apos;: &apos;1&apos;})] comparing [&apos;https?&apos;, &apos;.*&apos;, &apos;/.*&apos;, &apos;&apos;, &apos;&apos;, OrderedDict()] to [&apos;file&apos;, &apos;&apos;, &apos;/mnt/datum/repositories/misc&apos;, &apos;&apos;, &apos;&apos;, OrderedDict()]
DEBUG: For url [&apos;gitsm&apos;, &apos;github.com&apos;, &apos;/libjxl/libjxl.git&apos;, &apos;&apos;, &apos;&apos;, OrderedDict({&apos;protocol&apos;: &apos;https&apos;, &apos;nobranch&apos;: &apos;1&apos;})] comparing [&apos;git&apos;, &apos;sourceware.org&apos;, &apos;/git/glibc.git&apos;, &apos;&apos;, &apos;&apos;, OrderedDict()] to [&apos;https&apos;, &apos;downloads.yoctoproject.org&apos;, &apos;/mirror/sources/&apos;, &apos;&apos;, &apos;&apos;, OrderedDict()]
DEBUG: For url [&apos;gitsm&apos;, &apos;github.com&apos;, &apos;/libjxl/libjxl.git&apos;, &apos;&apos;, &apos;&apos;, OrderedDict({&apos;protocol&apos;: &apos;https&apos;, &apos;nobranch&apos;: &apos;1&apos;})] comparing [&apos;git&apos;, &apos;sourceware.org&apos;, &apos;/git/binutils-gdb.git&apos;, &apos;&apos;, &apos;&apos;, OrderedDict()] to [&apos;https&apos;, &apos;downloads.yoctoproject.org&apos;, &apos;/mirror/sources/&apos;, &apos;&apos;, &apos;&apos;, OrderedDict()]
DEBUG: Trying Upstream
ERROR: Bitbake Fetcher Error: NetworkAccess(&apos;gitsm://github.com/libjxl/libjxl.git;protocol=https;nobranch=1&apos;, &apos;LANG=C git -c gc.autoDetach=false -c core.pager=cat -c safe.bareRepository=all -c clone.defaultRemoteName=origin clone --bare --mirror https://github.com/libjxl/libjxl.git /mnt/datum/downloads/git2/github.com.libjxl.libjxl.git --progress&apos;)
DEBUG: Python function base_do_fetch finished</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>