Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] sync: call git prune before shallow fetch (bug 599008)
Date: Sat, 05 Nov 2016 20:43:47
Message-Id: 1478378595-4269-1-git-send-email-zmedico@gentoo.org
1 This is necessary in order to avoid "There are too many unreachable
2 loose objects" warnings from automatic git gc calls.
3
4 X-Gentoo-Bug: 599008
5 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=599008
6 ---
7 pym/portage/sync/modules/git/git.py | 6 ++++++
8 1 file changed, 6 insertions(+)
9
10 diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
11 index f288733..c90cf88 100644
12 --- a/pym/portage/sync/modules/git/git.py
13 +++ b/pym/portage/sync/modules/git/git.py
14 @@ -101,6 +101,12 @@ class GitSync(NewBase):
15 writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
16 return (e.returncode, False)
17
18 + # For shallow fetch, unreachable objects must be pruned
19 + # manually, since otherwise automatic git gc calls will
20 + # eventually warn about them (see bug 599008).
21 + subprocess.call(['git', 'prune'],
22 + cwd=portage._unicode_encode(self.repo.location))
23 +
24 git_cmd_opts += " --depth %d" % self.repo.sync_depth
25 git_cmd = "%s fetch %s%s" % (self.bin_command,
26 remote_branch.partition('/')[0], git_cmd_opts)
27 --
28 2.7.4

Replies