From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751525AbdAVC1C (ORCPT ); Sat, 21 Jan 2017 21:27:02 -0500 Received: from m13-94.163.com ([220.181.13.94]:8831 "EHLO m13-94.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751404AbdAVC0z (ORCPT ); Sat, 21 Jan 2017 21:26:55 -0500 X-Greylist: delayed 925 seconds by postgrey-1.27 at vger.kernel.org; Sat, 21 Jan 2017 21:26:54 EST X-Originating-IP: [27.223.99.130] Date: Sun, 22 Jan 2017 10:10:57 +0800 (CST) From: xufeng To: "Nico Schottelius" Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, wsa@the-dreams.de Subject: Re:Re: [PATCH] setlocalversion: fix error detectition of kernel git repository X-Priority: 3 X-Mailer: Coremail Webmail Server Version SP_ntes V3.5 build 20160729(86883.8884) Copyright (c) 2002-2017 www.mailtech.cn 163com In-Reply-To: <87a8ak876p.fsf@ungleich.ch> References: <1484954637.5246.4.camel@163.com> <87a8ak876p.fsf@ungleich.ch> Content-Type: text/plain; charset=GBK MIME-Version: 1.0 Message-ID: <72db5a75.262c.159c3f0d601.Coremail.xufwang@163.com> X-Coremail-Locale: zh_CN X-CM-TRANSID: XsGowAD3__OyFIRYepFLAQ--.21271W X-CM-SenderInfo: 50xi4tlqj6il2tof0z/xtbBaxlmIVetlPBDdAACse X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id v0M2RD87021478 I'm sorry. My patch is error. But I just want to get the git version when we use git as SCM. No matter what .git directory where. Thanks. At 2017-01-22 04:54:54, "Nico Schottelius" wrote: > >Hello Xufeng, > >why do you think redirecting *all* output to /dev/null is the right >thing todo? > >And which problem does it exactly fix? > >Do you see that there is a difference between a "return value" >(i.e. exit code) and the output (in this case stdout) of a program? > >Best, > >Nico > >xufeng writes: > >> This patch fixed the error using 'git rev-parse --show-cdup' to check >> that git is used as SCM to track the current directory. The return >> value of this command is not null string when the .git directory is >> not in kernel topdir. >> >> Signed-off-by: Xufeng Wang >> --- >> scripts/setlocalversion | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/scripts/setlocalversion b/scripts/setlocalversion >> index 966dd39..7966e39 100755 >> --- a/scripts/setlocalversion >> +++ b/scripts/setlocalversion >> @@ -43,7 +43,7 @@ scm_version() >> fi >> >> # Check for git and a git repo. >> -if test -z "$(git rev-parse --show-cdup 2>/dev/null)" && >> +if test -z "$(git rev-parse --show-cdup &>/dev/null)" && >> head=`git rev-parse --verify --short HEAD 2>/dev/null`; then >> >> # If we are at a tagged commit (like "v2.6.30-rc6"), we ignore > > >-- >Werde Teil des modernen Arbeitens im Glarnerland auf www.digitalglarus.ch! >Lese Neuigkeiten auf Twitter: www.twitter.com/DigitalGlarus >Diskutiere mit auf Facebook: www.facebook.com/digitalglarus