Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: "Michał Górny" <mgorny@g.o>
Cc: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] sync: call git prune before shallow fetch (bug 599008)
Date: Sat, 05 Nov 2016 22:11:19
Message-Id: 482f2a6d-f75c-cf38-a1b3-f952c1f2dc6b@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH] sync: call git prune before shallow fetch (bug 599008) by "Michał Górny"
1 On 11/05/2016 02:50 PM, Michał Górny wrote:
2 > On Sat, 5 Nov 2016 13:43:15 -0700
3 > Zac Medico <zmedico@g.o> wrote:
4 >
5 >> This is necessary in order to avoid "There are too many unreachable
6 >> loose objects" warnings from automatic git gc calls.
7 >>
8 >> X-Gentoo-Bug: 599008
9 >> X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=599008
10 >> ---
11 >> pym/portage/sync/modules/git/git.py | 6 ++++++
12 >> 1 file changed, 6 insertions(+)
13 >>
14 >> diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
15 >> index f288733..c90cf88 100644
16 >> --- a/pym/portage/sync/modules/git/git.py
17 >> +++ b/pym/portage/sync/modules/git/git.py
18 >> @@ -101,6 +101,12 @@ class GitSync(NewBase):
19 >> writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
20 >> return (e.returncode, False)
21 >>
22 >> + # For shallow fetch, unreachable objects must be pruned
23 >> + # manually, since otherwise automatic git gc calls will
24 >> + # eventually warn about them (see bug 599008).
25 >> + subprocess.call(['git', 'prune'],
26 >> + cwd=portage._unicode_encode(self.repo.location))
27 >> +
28 >> git_cmd_opts += " --depth %d" % self.repo.sync_depth
29 >> git_cmd = "%s fetch %s%s" % (self.bin_command,
30 >> remote_branch.partition('/')[0], git_cmd_opts)
31 >
32 > Does it have a performance impact?
33
34 Yes, it takes about 20 seconds on my laptop. I suppose we could make
35 this an optional thing, so that those people can do it manually if they
36 want.
37 --
38 Thanks,
39 Zac

Replies