Change the default sync depth to 1 for git.
I think setting the default sync-depth/clone-depth to 1 is a good idea.
Chatter in irc/reddit/etc shows more and more people switching to git repositories, typically copy-pasting a repo configuration.
These neglect setting sync-depth/clone-depth to 1, resulting in the entire repository history being pulled.
The sorts of users who care for repository history will be vigilent enough to set sync-depth/clone-depth to an appropriate value.
Changing defaults is generally frowned upon because it typically results in lots of unpleasantly surprised people. However, we can make it more acceptable if we provide backward compatibility for existing installs, like we did for bug 378603 (existing installs continue to use /usr/portage instead of the new /var/db/repos/gentoo default location).
Is this not a dupe of bug 552814 ?
(In reply to Michael 'veremitz' Everitt from comment #3)
> Is this not a dupe of bug 552814 ?
The request is to make it the default behavior. I think we could do that as long as we don't modify the behavior for existing that have unlimited sync depth enabled. In order to avoid changing the behavior for users who currently have unlimited sync depth enabled, we can use a portage._compat_upgrade routine like we currently use for compatibility with old repository locations (/usr/portage) and BINPKG_COMPRESS (bzip2 vs zstd).
For me at least, the current default behaviour is super-confusing, as clone-depth is 1 and sync-depth is 0 by default. That means, that the initial sync will be quick, but the first subsequent sync will take /ages/ on the main tree, without any output. IMO, sync-depth and clone-depth should at least default to the same value, ideally 1.
sync-depth and clone-depth should be 1 by default, and it should be possible to globally configure sync-depth and clone-depth.
Configuring sync-depth and clone-depth manually for each overlay by hand is very tedious and prone to errors.
(In reply to amano.kenji from comment #6)
> sync-depth and clone-depth should be 1 by default, and it should be possible
> to globally configure sync-depth and clone-depth.
A DEFAULT section in repos.conf should work, like this:
sync-depth = 1
clone-depth = 1
Can multiple files in repos.conf have [DEFAULT] section?
(In reply to amano.kenji from comment #8)
> Can multiple files in repos.conf have [DEFAULT] section?
Yes. You can use this command to see the effective repos.conf including the DEFAULT section:
portageq envvar PORTAGE_REPOSITORIES
1. It should be able to configure sync-depth and clone-depth in DEFAULT section.
2. Migration script can set sync-depth and clone-depth in a DEFAULT section of its own file in /etc/portage/repos.conf.
Looks like this eventually made it into Portage, outside of this bug:
Author: David Sardari <email@example.com>
Date: Thu Mar 31 22:29:54 2022 +0200
GitSync.update: default to "--depth 1" (bug 824782 comment 17)
Enforce the use of "--depth" in both GitSync.new and GitSync.update following the same logic.
Each function gets its own designated portage option of "clone-depth" and "sync-depth".
This means that portage option "sync-depth" is not taken into consideration anymore in GitSync.new.
Portage option "clone-depth" and "sync-depth" lead to following behaviour with a value of:
- 0: The use of "--depth <value>" is disabled causing the retrieval of the whole Git history.
- ℕ (positive integer): "--depth <value>" is used.
- Unset portage option: "--depth 1" is used.
Signed-off-by: David Sardari <firstname.lastname@example.org>
Signed-off-by: Sam James <email@example.com>