[Buildroot] [git commit] support/download/git: use FOO_DL_OPTS

Thomas Petazzoni thomas.petazzoni at bootlin.com
Sat Apr 19 15:10:07 UTC 2025


commit: https://git.buildroot.net/buildroot/commit/?id=a1012b363a286125978de529eacf9d187d95907f
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

The manual states that FOO_DL_OPTS are valid for all the different
download backends, but that is not the case: at least the git backend
does not use them (it does not fail, it just ignores them).

Accept FOO_DL_OPTS in the git backend, and pass them to 'git fetch'.
There is no way that we can pass such options to submodules or lfs,
though.

Update the manual accordingly.

Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
---
 docs/manual/adding-packages-generic.adoc | 4 +++-
 support/download/git                     | 6 +++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/docs/manual/adding-packages-generic.adoc b/docs/manual/adding-packages-generic.adoc
index f0b0508f53..7e2e066c16 100644
--- a/docs/manual/adding-packages-generic.adoc
+++ b/docs/manual/adding-packages-generic.adoc
@@ -270,7 +270,9 @@ not and can not work as people would expect it should:
   server-side checking for user logins and passwords, or to use a proxy.
   All download methods valid for +LIBFOO_SITE_METHOD+ are supported;
   valid options depend on the download method (consult the man page
-  for the respective download utilities).
+  for the respective download utilities). For git, +FOO_DL_OPTS+ will
+  only be passed to `git fetch` and no other git command (esp. not to
+  `git lfs fetch` or `git submodule update`).
 
 * +LIBFOO_EXTRA_DOWNLOADS+ is a space-separated list of additional
   files that Buildroot should download. If an entry contains +://+
diff --git a/support/download/git b/support/download/git
index 8123bc3153..fdc00607cc 100755
--- a/support/download/git
+++ b/support/download/git
@@ -133,8 +133,8 @@ fi
 _git remote set-url origin "'${uri}'"
 
 printf "Fetching all references\n"
-_git fetch origin
-_git fetch origin -t -f
+_git fetch "${@}" origin
+_git fetch "${@}" origin -t -f
 
 # Try to get the special refs exposed by some forges (pull-requests for
 # github, changes for gerrit...). There is no easy way to know whether
@@ -143,7 +143,7 @@ _git fetch origin -t -f
 # below, if there is an issue anyway. Since most of the cset we're gonna
 # have to clone are not such special refs, consign the output to oblivion
 # so as not to alarm unsuspecting users, but still trace it as a warning.
-if ! _git fetch origin "'${cset}:${cset}'" >/dev/null 2>&1; then
+if ! _git fetch "${@}" origin "'${cset}:${cset}'" >/dev/null 2>&1; then
     printf "Could not fetch special ref '%s'; assuming it is not special.\n" "${cset}"
 fi
 


More information about the buildroot mailing list