diff mbox series

[08/15] fetch2: gitsm: remove duplicate code

Message ID 20250902064515.30879-9-stefan.herbrechtsmeier-oss@weidmueller.com
State New
Headers show
Series fetch2: gitsm: rework and simplify | expand

Commit Message

Stefan Herbrechtsmeier Sept. 2, 2025, 6:45 a.m. UTC
From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>

Remove the duplicate append of the nobranch parameter from the loops and
move duplicate append of the bareclone parameter from the loops to the
URL creation.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
---

 lib/bb/fetch2/gitsm.py | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/lib/bb/fetch2/gitsm.py b/lib/bb/fetch2/gitsm.py
index 497661bd6..953a1ca39 100644
--- a/lib/bb/fetch2/gitsm.py
+++ b/lib/bb/fetch2/gitsm.py
@@ -124,6 +124,7 @@  class GitSM(Git):
             url += ";nobranch=1"
             url += ";lfs=%s" % ("1" if self._need_lfs(ud) else "0")
             url += ";rev=%s" % subrevision[module]
+            url += ";bareclone=1"
             # Note that adding "user=" here to give credentials to the
             # submodule is not supported. Since using SRC_URI to give git://
             # URL a password is not supported, one have to use one of the
@@ -157,8 +158,6 @@  class GitSM(Git):
 
         need_update_list = []
         def need_update_submodule(ud, url, module, modpath, workdir, d):
-            url += ";bareclone=1;nobranch=1"
-
             try:
                 newfetch = Fetch([url], d, cache=False)
                 new_ud = newfetch.ud[url]
@@ -178,8 +177,6 @@  class GitSM(Git):
 
     def download(self, ud, d):
         def download_submodule(ud, url, module, modpath, workdir, d):
-            url += ";bareclone=1;nobranch=1"
-
             # Is the following still needed?
             #url += ";nocheckout=1"
 
@@ -197,8 +194,6 @@  class GitSM(Git):
         subdestdir = self.destdir(ud, destdir, d)
 
         def unpack_submodules(ud, url, module, modpath, workdir, d):
-            url += ";bareclone=1;nobranch=1"
-
             # Figure out where we clone over the bare submodules...
             if ud.bareclone:
                 repo_conf = ''
@@ -239,7 +234,6 @@  class GitSM(Git):
             runfetchcmd("%s%s submodule update --recursive --no-fetch" % (cmdprefix, ud.basecmd), d, quiet=True, workdir=subdestdir)
     def clean(self, ud, d):
         def clean_submodule(ud, url, module, modpath, workdir, d):
-            url += ";bareclone=1;nobranch=1"
             try:
                 newfetch = Fetch([url], d, cache=False)
                 newfetch.clean()
@@ -256,7 +250,6 @@  class GitSM(Git):
 
         urldata = []
         def add_submodule(ud, url, module, modpath, workdir, d):
-            url += ";bareclone=1;nobranch=1"
             newfetch = Fetch([url], d, cache=False)
             urldata.extend(newfetch.expanded_urldata())