public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/sync/modules/git/
Date: Wed, 21 Dec 2022 01:28:10 +0000 (UTC)	[thread overview]
Message-ID: <1671586083.ac405c994a0cce67e11c1bc7fb37fc02bba627ae.sam@gentoo> (raw)

commit:     ac405c994a0cce67e11c1bc7fb37fc02bba627ae
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 17 05:19:32 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Dec 21 01:28:03 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=ac405c99

sync: git: allow truncating history if repository is marked volatile

See 54a08c9f71dc37851fdb0364576581ca19df6580 for an explanation
of the context here.

If the repository is marked as volatile, it's assumed that
Portage has complete control of it, and for Portage's purposes,
there's no use in having extended history (in fact, if anything,
it's deterimental, as it makes a sync more likely to fail due
to the large disk space requirements over time).

Bug: https://bugs.gentoo.org/824782
Bug: https://bugs.gentoo.org/887025
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/portage/sync/modules/git/git.py | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/lib/portage/sync/modules/git/git.py b/lib/portage/sync/modules/git/git.py
index f16af0622..8602fecba 100644
--- a/lib/portage/sync/modules/git/git.py
+++ b/lib/portage/sync/modules/git/git.py
@@ -155,19 +155,24 @@ class GitSync(NewBase):
         if self.repo.sync_depth is not None:
             sync_depth = self.repo.sync_depth
         else:
-            # If sync-depth is not explicitly set by the user,
-            # then check if the target repository is already a
-            # shallow one. And do not perform a shallow update if
-            # the target repository is not shallow.
-            is_shallow_cmd = ["git", "rev-parse", "--is-shallow-repository"]
-            is_shallow_res = portage._unicode_decode(
-                subprocess.check_output(
-                    is_shallow_cmd,
-                    cwd=portage._unicode_encode(self.repo.location),
+            if self.repo.volatile:
+                # If sync-depth is not explicitly set by the user,
+                # then check if the target repository is already a
+                # shallow one. And do not perform a shallow update if
+                # the target repository is not shallow.
+                is_shallow_cmd = ["git", "rev-parse", "--is-shallow-repository"]
+                is_shallow_res = portage._unicode_decode(
+                    subprocess.check_output(
+                        is_shallow_cmd,
+                        cwd=portage._unicode_encode(self.repo.location),
+                    )
                 )
-            )
-            if is_shallow_res == "false":
-                sync_depth = 0
+                if is_shallow_res == "false":
+                    sync_depth = 0
+            else:
+                # If the repository is marked as non-volatile, we assume
+                # it's fine to Portage to do what it wishes to it.
+                sync_depth = 1
 
         shallow = False
         if sync_depth > 0:


             reply	other threads:[~2022-12-21  1:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-21  1:28 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-05-12 16:20 [gentoo-commits] proj/portage:master commit in: lib/portage/sync/modules/git/ Sam James
2023-12-14  4:30 Sam James
2023-10-31  0:35 Sam James
2023-10-22 19:03 Sam James
2023-10-22 19:03 Sam James
2023-10-22 19:03 Sam James
2023-08-17  6:59 Sam James
2023-08-17  6:53 Sam James
2023-02-27  6:15 Sam James
2023-02-25 23:22 Sam James
2023-02-24  9:22 Sam James
2023-02-24  9:22 Sam James
2023-02-24  9:22 Sam James
2022-12-21  1:28 Sam James
2022-12-21  1:28 Sam James
2022-11-20  3:12 Sam James
2022-07-03  0:56 Mike Gilbert
2020-07-02 22:08 Zac Medico
2018-07-23 19:58 Zac Medico
2018-07-23 18:52 Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1671586083.ac405c994a0cce67e11c1bc7fb37fc02bba627ae.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox