Re: Shallow git update in bootstrap

2023-08-06 Thread Carles Pina i Estany


Hi,

On 06 Aug 2023 at 16:56:45, Bruno Haible wrote:
> Carles Pina i Estany wrote:

> > When I say "long time" (and data transmission) in my case it's 9
> > minutes:
> > -
> > carles@pinux:[master]~/git/wget2$ time git submodule update --init 
> > Cloning into '/home/carles/git/wget2/gnulib'...
> > Submodule path 'gnulib': checked out 
> > '2ae6faf9c78384dc6a2674b62dd56ff153cd51f6'
> > 
> > real9m1,135s
> > user6m24,309s
> > sys 0m5,020s
> > -

above was with a 4G+ connection and a laptop

> I can reproduce that the --depth option has a big impact on the
> 'git clone' execution time:
> 
>   - no --depth:   50 sec.
>   - --depth=2000: 16 sec.
>   - --depth=1: 5 sec.

In my day to day VPS server (low spec):
- no --depth:   6 minutes (majority of time in "resolving deltas") (152
MB in the cloned directory)
- --depth=2000: 1 min 30 sec (100 MB)
- --depth=1:7 seconds (88 MB)

> However, --depth=1 has the problem that it may/will cause trouble to the
> developer later, if they use more than "git pull". Namely,
>   - In 'git log' the history will be truncated,
>   - 'git bisect' may not work,
>   - 'git annotate' will show a wrong author for many lines of code.
> 
> '--depth=2000' would be a middle ground, but it still has the 'git annotate'
> problem.

agree with above

> These troubles are probably not worth the saved 'git clone' time upfront.
> 
> However, when doing automated builds, such as continuous integration,
> --depth=1 saves a lot of time, and is not problematic, since the build
> directory is getting deleted anyway 10 minutes later.
> 
> How about adding to 'bootstrap' an option '--for-build' that has the
> effect that all submodule clones will be fetched with --depth=1 ?

>From my initial point of view (slower connections, metered connections)
and also for saving CI building time and bandwidth (and
git.savannah.gnu.org bandwidth): an option '--for-build' seems very
useful.

Thanks for considering it,

-- 
Carles Pina i Estany
https://carles.pina.cat || Wiktionary translations: https://kamus.pina.cat



Shallow git update in bootstrap

2023-08-05 Thread Carles Pina i Estany


Hi,

This is a wishlist / question regarding using "--depth 2" in "git
submodule init --" in the bootstrap file.

I was building a project that uses gnulib (with bootstrap).

./bootstrap does:

"""
if git_modules_config submodule.gnulib.url >/dev/null; then
echo "$0: getting gnulib files..."
git submodule init -- "$gnulib_path" || exit $?
git submodule update -- "$gnulib_path" || exit $?
"""

The "git submodule update" takes a long time. Would it be possible to
use "--depth 1" there? (and in other "git submodule update"s?

A few lines below it checks if "git clone -h 2>&1" has the option
--depth and use it if possible. Perhaps the same approch could be done
in the "git submodule update"s ? (in my case the default code path uses
"git submodule update" and not "git clone" with the --depth 2)

I wonder if there is any reason not to use the --depth 2 for the update.

When I say "long time" (and data transmission) in my case it's 9
minutes:
-
carles@pinux:[master]~/git/wget2$ time git submodule update --init 
Cloning into '/home/carles/git/wget2/gnulib'...
Submodule path 'gnulib': checked out '2ae6faf9c78384dc6a2674b62dd56ff153cd51f6'

real    9m1,135s
user6m24,309s
sys 0m5,020s
-

Actually, the first time I wondered if the connection or something else
failed.

Thank you very much,

-- 
Carles Pina i Estany
https://carles.pina.cat || Wiktionary translations: https://kamus.pina.cat