Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH] git sync: silence 'git rev-parse' errors
Date: Sat, 17 Jan 2015 22:07:50
Message-Id: 54BADD32.1010907@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] git sync: silence 'git rev-parse' errors by "Michał Górny"
1 On 01/17/2015 04:28 AM, Michał Górny wrote:
2 > Discard the git-rev-parse error output to avoid 'fatal: Not a git
3 > repository [...]' errors when checking whether the repository exists.
4 > ---
5 > pym/portage/sync/modules/git/git.py | 2 +-
6 > 1 file changed, 1 insertion(+), 1 deletion(-)
7 >
8 > diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py
9 > index b97d501..02da037 100644
10 > --- a/pym/portage/sync/modules/git/git.py
11 > +++ b/pym/portage/sync/modules/git/git.py
12 > @@ -36,7 +36,7 @@ class GitSync(SyncBase):
13 >
14 > if not os.path.exists(self.repo.location):
15 > return False
16 > - exitcode = portage.process.spawn_bash("cd %s ; git rev-parse" %\
17 > + exitcode = portage.process.spawn_bash("cd %s ; git rev-parse 2>/dev/null" %\
18 > (portage._shell_quote(self.repo.location),),
19 > **portage._native_kwargs(self.spawn_kwargs))
20 > if exitcode == 128:
21 >
22
23 Why don't we just skip the git rev-parse call entirely, if not
24 os.path.isdir(os.path.join(self.repo.location, ".git"))?
25 --
26 Thanks,
27 Zac

Replies