Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 673412 - sys-apps/portage: Use default sync-depth of 1
Summary: sys-apps/portage: Use default sync-depth of 1
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Unclassified (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
Depends on: 873757
Blocks: 671174 726334 835380
  Show dependency tree
Reported: 2018-12-19 06:26 UTC by Raymond Jennings
Modified: 2023-02-21 07:55 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Raymond Jennings 2018-12-19 06:26:44 UTC
Change the default sync depth to 1 for git.
Comment 1 Sebastian Pucilowski 2019-11-01 07:41:44 UTC
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.
Comment 2 Zac Medico gentoo-dev 2019-11-01 21:14:32 UTC
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).
Comment 3 Michael 'veremitz' Everitt 2020-08-27 02:44:05 UTC
Is this not a dupe of bug 552814 ?
Comment 4 Zac Medico gentoo-dev 2020-08-27 16:55:53 UTC
(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).
Comment 5 Benedikt Reinartz 2021-12-05 14:05:22 UTC
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.
Comment 6 amano.kenji 2022-05-27 06:40:09 UTC
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.
Comment 7 Zac Medico gentoo-dev 2022-05-28 17:09:27 UTC
(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
Comment 8 amano.kenji 2022-05-28 21:14:41 UTC
Can multiple files in repos.conf have [DEFAULT] section?
Comment 9 Zac Medico gentoo-dev 2022-05-28 21:46:17 UTC
(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:

Comment 10 amano.kenji 2022-05-28 21:49:46 UTC
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.
Comment 11 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2023-02-21 00:00:26 UTC
Looks like this eventually made it into Portage, outside of this bug:

commit f2207e41792d8180519e5695934af05daad3c971
Author: David Sardari <>
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 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

    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 <>
    Signed-off-by: Sam James <>