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] git sync: silence 'git rev-parse' errors
Date: Sun, 18 Jan 2015 00:31:28
Message-Id: 20150118013114.3d4b57b2@pomiot.lan
In Reply to: Re: [gentoo-portage-dev] [PATCH] git sync: silence 'git rev-parse' errors by Zac Medico
1 Dnia 2015-01-17, o godz. 14:07:46
2 Zac Medico <zmedico@g.o> napisał(a):
3
4 > On 01/17/2015 04:28 AM, Michał Górny wrote:
5 > > Discard the git-rev-parse error output to avoid 'fatal: Not a git
6 > > repository [...]' errors when checking whether the repository exists.
7 > > ---
8 > > pym/portage/sync/modules/git/git.py | 2 +-
9 > > 1 file changed, 1 insertion(+), 1 deletion(-)
10 > >
11 > > diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
12 > > index b97d501..02da037 100644
13 > > --- a/pym/portage/sync/modules/git/git.py
14 > > +++ b/pym/portage/sync/modules/git/git.py
15 > > @@ -36,7 +36,7 @@ class GitSync(SyncBase):
16 > >
17 > > if not os.path.exists(self.repo.location):
18 > > return False
19 > > - exitcode = portage.process.spawn_bash("cd %s ; git rev-parse" %\
20 > > + exitcode = portage.process.spawn_bash("cd %s ; git rev-parse 2>/dev/null" %\
21 > > (portage._shell_quote(self.repo.location),),
22 > > **portage._native_kwargs(self.spawn_kwargs))
23 > > if exitcode == 128:
24 > >
25 >
26 > Why don't we just skip the git rev-parse call entirely, if not
27 > os.path.isdir(os.path.join(self.repo.location, ".git"))?
28
29 I don't know ;). I guess the current magic is more 'correct', i.e.
30 distinguishes broken repo. Of course, it all will probably fall apart
31 if it's broken but...!
32
33 --
34 Best regards,
35 Michał Górny

Replies