diff mbox series

doc: bitbake-user-manual-ref-variables: document BB_GIT_SHALLOW_EXTRA_REFS

Message ID 20251105080516.647480-2-m.schwan@phytec.de
State Accepted, archived
Commit 580601d7a721ccd5b5ed0ea36b51183900ec8d3a
Headers show
Series doc: bitbake-user-manual-ref-variables: document BB_GIT_SHALLOW_EXTRA_REFS | expand

Commit Message

Martin Schwan Nov. 5, 2025, 8:05 a.m. UTC
Describe BB_GIT_SHALLOW_EXTRA_REFS which allows keeping additional refs
for shallow clones.

Signed-off-by: Martin Schwan <m.schwan@phytec.de>
---
 .../bitbake-user-manual-ref-variables.rst       | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Quentin Schulz Nov. 11, 2025, 3:43 p.m. UTC | #1
Hi Martin,

On 11/5/25 9:05 AM, Martin Schwan via lists.openembedded.org wrote:
> [You don't often get email from m.schwan=phytec.de@lists.openembedded.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> 
> Describe BB_GIT_SHALLOW_EXTRA_REFS which allows keeping additional refs
> for shallow clones.
> 

Available since sumo (bitbake 1.36.0), commit 1771934cd9f8 ("fetch/git: 
add support for keeping extra refs for shallow").

It'd be nice to provide this kind of info in the future, helps deciding 
if and for which branches to backport this.

> Signed-off-by: Martin Schwan <m.schwan@phytec.de>
> ---
>   .../bitbake-user-manual-ref-variables.rst       | 17 +++++++++++++++++
>   1 file changed, 17 insertions(+)
> 
> diff --git a/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst b/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst
> index 734c7858a..309477071 100644
> --- a/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst
> +++ b/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst
> @@ -399,6 +399,23 @@ overview of their function and contents.
> 
>         For example usage, see :term:`BB_GIT_SHALLOW`.
> 
> +   :term:`BB_GIT_SHALLOW_EXTRA_REFS`
> +      With :term:`BB_GIT_SHALLOW` enabled, by default, all unused refs (branches
> +      and tags) are removed from the repository, as shallow processing scales
> +      with the number of refs it has to process.
> +
> +      :term:`BB_GIT_SHALLOW_EXTRA_REFS` allows to explicitly specify additional
> +      refs to keep. This is particularly useful for recipes with custom checkout
> +      processes, or whose Git-based versioning requires a tag be available (i.e.

Gut feeling says it should be "with a custom checkout process". I'm not 
a native speaker so eh.

> +      for ``git describe --tags``). The :term:`BB_GIT_SHALLOW_EXTRA_REFS`
> +      variable is a space-separated list of refs, fully specified, and supports
> +      wildcards.
> +
> +      Example usage::
> +
> +         BB_GIT_SHALLOW_EXTRA_REFS = "refs/tags/v1.0"
> +         BB_GIT_SHALLOW_EXTRA_REFS += "refs/heads/*"
> +

I've read the code and it seems that if one specifies ;tag=X in SRC_URI 
for a source fetched by the git fetcher, that will make it make it to 
the list of refs that are kept (though not via the variable!). Something 
similar is applicable to the gitannex fetcher with git-annex and 
synced/* refs. I'm wondering if this is something we should document or 
not? @Antonin?

Looks good to me in any case, so:

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>

Thanks!
Quentin
diff mbox series

Patch

diff --git a/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst b/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst
index 734c7858a..309477071 100644
--- a/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst
+++ b/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst
@@ -399,6 +399,23 @@  overview of their function and contents.
 
       For example usage, see :term:`BB_GIT_SHALLOW`.
 
+   :term:`BB_GIT_SHALLOW_EXTRA_REFS`
+      With :term:`BB_GIT_SHALLOW` enabled, by default, all unused refs (branches
+      and tags) are removed from the repository, as shallow processing scales
+      with the number of refs it has to process.
+
+      :term:`BB_GIT_SHALLOW_EXTRA_REFS` allows to explicitly specify additional
+      refs to keep. This is particularly useful for recipes with custom checkout
+      processes, or whose Git-based versioning requires a tag be available (i.e.
+      for ``git describe --tags``). The :term:`BB_GIT_SHALLOW_EXTRA_REFS`
+      variable is a space-separated list of refs, fully specified, and supports
+      wildcards.
+
+      Example usage::
+
+         BB_GIT_SHALLOW_EXTRA_REFS = "refs/tags/v1.0"
+         BB_GIT_SHALLOW_EXTRA_REFS += "refs/heads/*"
+
    :term:`BB_GLOBAL_PYMODULES`
       Specifies the list of Python modules to place in the global namespace.
       It is intended that only the core layer should set this and it is meant