From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC04FC43463 for ; Sun, 20 Sep 2020 16:20:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A1CDA2075E for ; Sun, 20 Sep 2020 16:20:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726367AbgITQUh (ORCPT ); Sun, 20 Sep 2020 12:20:37 -0400 Received: from smtprelay0155.hostedemail.com ([216.40.44.155]:41372 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726311AbgITQUh (ORCPT ); Sun, 20 Sep 2020 12:20:37 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay06.hostedemail.com (Postfix) with ESMTP id 3C8AB18224D7E; Sun, 20 Sep 2020 16:20:36 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: tramp39_4902a322713d X-Filterd-Recvd-Size: 1866 Received: from XPS-9350.home (unknown [47.151.133.149]) (Authenticated sender: joe@perches.com) by omf07.hostedemail.com (Postfix) with ESMTPA; Sun, 20 Sep 2020 16:20:35 +0000 (UTC) Message-ID: Subject: [PATCH -next] checkpatch: Fix git "fatal" warning if file argument outside kernel tree From: Joe Perches To: Andrew Morton Cc: linux-kernel@vger.kernel.org, linux@rasmusvillemoes.dk, Julia Lawall , apw@canonical.com Date: Sun, 20 Sep 2020 09:20:34 -0700 In-Reply-To: References: Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.36.4-0ubuntu1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit bcf4271d4bc3 ("checkpatch: allow not using -f with files that are in git") in linux-next causes checkpatch to emit a fatal message: fatal: : '' is outside repository at '' Fix that by sending git's error output to /dev/null instead. Signed-off-by: Joe Perches Reported-by: Julia Lawall Reviewed-by: Julia Lawall --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 3e474072aa90..469f8e7456df 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -981,7 +981,7 @@ sub git_is_single_file { return 0 if ((which("git") eq "") || !(-e "$gitroot")); - my $output = `${git_command} ls-files -- $filename`; + my $output = `${git_command} ls-files -- $filename 2>/dev/null`; my $count = $output =~ tr/\n//; return $count eq 1 && $output =~ m{^${filename}$}; }