[bug #66357] Bootstrap script clone gnulib always with full history.

hetii <[email protected]> Sat, 19 Oct 2024 13:11:01 -0400 (EDT)
Newsgroups gmane.comp.boot-loaders.grub.bugs
Message-ID <[email protected]>
URL:
  <https://savannah.gnu.org/bugs/?66357>

                 Summary: Bootstrap script clone gnulib always with full
history.
                   Group: GNU GRUB
               Submitter: hetii
               Submitted: Sat 19 Oct 2024 05:10:58 PM UTC
                Category: Compilation
                Severity: Major
                Priority: 5 - Normal
              Item Group: Software Error
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: Git master
                 Release: 
         Reproducibility: Every Time
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Sat 19 Oct 2024 05:10:58 PM UTC By: hetii <hetii>
Hello.

I notice that original bootstrap script grep by '--depth' parameter to check
if git is able clone gnulib in shallow mode.

eg:
        git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth
2'
        git fetch -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth
2'

This checks is always false for current git version at least in ubuntu images
as the argument seams to be now:

        --[no-]depth <depth>  deepen history of shallow clone

As a result, gnulib is always cloned with full history (139MB).

For workaround I use sed to use regex instead.

        sed -i -e s/'-- --depth'/'-E -- \'\''--\(\\[no-\\]\)?depth'\'/g
bootstrap

Then, the original lines are change to:
        git clone -h 2>&1 | grep -E -- '--(\[no-\])?depth' > /dev/null &&
shallow='--depth 2'
        git fetch -h 2>&1 | grep -E -- '--(\[no-\])?depth' > /dev/null &&
shallow='--depth 2'

Now the grep regex support '--depth' as well as '--[no-]depth'.

By this small change gnulib size is reduced to 84MB and clone a bit faster.

I'm only not sure why shallow is set to '--depth 2' instead '--depth 1' by
default.

Regards.







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?66357>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCZxPoJQAKCRCqLAuaBUf3
TjhTAP4s14X+3/3j5kh/earQ18ZxX/3UV5pBEZIYBTD77D3H8gEAor+NwtOJVvEc
Ninc1+fTsI3VXZmDs/Gw0e4trGNpgw0=
=9PX5
-----END PGP SIGNATURE-----