Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp598061imu; Fri, 16 Nov 2018 07:20:04 -0800 (PST) X-Google-Smtp-Source: AJdET5c8PPXNWgAZpdg99vtOVWjJN3VnD30Rgt1HZwGePRwhgvSa5lVi+QniLy08eLf3n6xiSAVo X-Received: by 2002:a63:561b:: with SMTP id k27mr10346227pgb.271.1542381604469; Fri, 16 Nov 2018 07:20:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542381604; cv=none; d=google.com; s=arc-20160816; b=FppTfteOxzOQqu9AbZO8559tWygnGppc5TFRODcsXxHTmH9+nrY1OuG8qHa76uFi2U bb89GkPDmAmWpO13bFuO5w3GbYHsiM8CkH1lvrY/lVemqOu3Btexu2KOp7NUHSmYl4wr dTaFBZITdpJNDpMe+rjIZcHCcsxddPvLCV2Li9sZs0dT9vEL55VsywzT9vI9nNqODy55 /8gj+P/W3Wbbps7oLALxy8hxjkOdNsxiV5WwxhhwnJugtKN6hburnccypKU+iwhkpcfg n3Bur1reAGzRnjaixvh5Xfrd3h/E2uBR0kyqPeVyJDOl1dXWO0RdG17iHvlpFT8Gxfwf T3ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=QgRVSbdNlpAhM3GhMg4oLHwLIoQd9IgUYkTYc/KwbC4=; b=yhpQJskld2Y0ciUMFxT3ooXZPHg4SvfFMEsZbRqP+Y8ktqm+2zkQ1FFZ9jYtujr0+U fk41Rg4nF5beGQUl8h944o4Cb8c4zhaxSKcPnpiLaOK5d5+JJA0thAA+TIOZuS66ab95 i5G+kZdTK5JIJ7TlxBntUr2D4TKuw1CVLpICzcI8G2ZpRERfk2FSovvg7eFCPSaxv0uo rsxg7k29aJdIUMkOKEh6Wm35RGhVOl8HNnTUrDPUXmBpZmyw+f/bl+NM361Di7vDkeKp 2xVvrwwYjCstepYnf3GJ4hdg5X4JaK0HMq2T94f+jh2B/Q6AzPELKEAsODtm0roYIMqX 7nBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=s9qPdIAh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 129-v6si34443326pfy.164.2018.11.16.07.19.49; Fri, 16 Nov 2018 07:20:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=s9qPdIAh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390014AbeKQBbh (ORCPT + 99 others); Fri, 16 Nov 2018 20:31:37 -0500 Received: from conssluserg-01.nifty.com ([210.131.2.80]:49305 "EHLO conssluserg-01.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728169AbeKQBbh (ORCPT ); Fri, 16 Nov 2018 20:31:37 -0500 Received: from mail-vs1-f54.google.com (mail-vs1-f54.google.com [209.85.217.54]) (authenticated) by conssluserg-01.nifty.com with ESMTP id wAGFIMtt001261 for ; Sat, 17 Nov 2018 00:18:22 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-01.nifty.com wAGFIMtt001261 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1542381502; bh=QgRVSbdNlpAhM3GhMg4oLHwLIoQd9IgUYkTYc/KwbC4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=s9qPdIAhS9Ewq8zuIQG8/98QXNGpYPlgKLRzooxx17q1Rs1gTVNJtj8KZ8XGd1aKG q4gdm7rt8mIAINXTY/AVJop9+GgVB4VPsy1rUnlgPpJm9+0ECtoJ0w51kBkR1XFlRD Vqh/4w64VsORAk+3D58j23jXwmD7+BMX5/eO3T7mHpql9A0zTIWSWCpft33ACXE+u2 K1/SEdTBcMA4osR1naz+nLA9YAw2ZtHBf83hccu3OTfmSFQaLwF8nld/wk320tvkOI yoY5IXgWdELy2TJgCeQcaK8uhKhKW9RomLwRLDFmt4NUpMekAuQvbND6qrODF3H8wq qwCMoOp1SPp+w== X-Nifty-SrcIP: [209.85.217.54] Received: by mail-vs1-f54.google.com with SMTP id h78so13925518vsi.6 for ; Fri, 16 Nov 2018 07:18:22 -0800 (PST) X-Gm-Message-State: AGRZ1gKkXKMCQOLSl73jsXZxECgi+Cz3sfapC29iiL2A1lj669inN2Ju 63+YmPRWPJ571hw7PJ3K9uf/kHmgwHl3ylW5Agc= X-Received: by 2002:a67:f1d6:: with SMTP id v22mr4574957vsm.181.1542381501222; Fri, 16 Nov 2018 07:18:21 -0800 (PST) MIME-Version: 1.0 References: <20181111.174140.002789201@genki.is> <20181113000938.GA16783@google.com> <20181113190335.GA50985@google.com> <878t1w7hzi.fsf@igel.home> <20181115021116.GA195691@google.com> In-Reply-To: <20181115021116.GA195691@google.com> From: Masahiro Yamada Date: Sat, 17 Nov 2018 00:17:45 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks To: Brian Norris Cc: alexander.kapshuk@gmail.com, Genki Sky , Douglas Anderson , Guenter Roeck , Christian Kujau , Linux Kernel Mailing List , schwab@linux-m68k.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 15, 2018 at 11:12 AM Brian Norris wrote: > > git-diff-index does not refresh the index for you, so using it for a > "-dirty" check can give misleading results. Commit 6147b1cf19651 > ("scripts/setlocalversion: git: Make -dirty check more robust") tried to > fix this by switching to git-status, but it overlooked the fact that > git-status also writes to the .git directory of the source tree, which > is definitely not kosher for an out-of-tree (O=) build. That is getting > reverted. > > Fortunately, git-status now supports avoiding writing to the index via > the --no-optional-locks flag, as of git 2.14. It still calculates an > up-to-date index, but it avoids writing it out to the .git directory. > > So, let's retry the solution from commit 6147b1cf19651 using this new > flag first, and if it fails, we assume this is an older version of git > and just use the old git-diff-index method. > > It's hairy to get the 'grep -vq' (inverted matching) correct by stashing > the output of git-status (you have to be careful about the difference > betwen "empty stdin" and "blank line on stdin"), so just pipe the output > directly to grep and use a regex that's good enough for both the > git-status and git-diff-index version. > > Cc: Genki Sky > Cc: Christian Kujau > Cc: Guenter Roeck > Suggested-by: Alexander Kapshuk > Signed-off-by: Brian Norris Worked for me, and clean implementation. Nice! I will wait a few days before I pick it up in case some people may give comments, Reviewed-by, Tested-by, etc. -- Best Regards Masahiro Yamada