Gentoo Archives: gentoo-portage-dev

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

Replies