Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5089567imu; Tue, 13 Nov 2018 00:37:16 -0800 (PST) X-Google-Smtp-Source: AJdET5ckVE0WTTNMkM/2YcNb2Pgb4qJ3NwKcsAUJ9mjH4aHdf0DCjg/378twBs2RLaexozDD8VeI X-Received: by 2002:a17:902:8d94:: with SMTP id v20-v6mr4220322plo.109.1542098235975; Tue, 13 Nov 2018 00:37:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542098235; cv=none; d=google.com; s=arc-20160816; b=scQeCiP2+dN+ZmP+sAxf9oFVJkVpNl7htZecCtjk7R/x8CQObMW5HgLpwhHoNcj1Vi zeBqInhGhnnmYkafMpb+hY6/yQmvgcmYlH3GPOQ682WWA9zkTb+Q12OzjwQ0dUV2L+1S cyw4FCV517iyR4hf1fFFFPz+vtEyWfC6ZMMCDhVLYbSH/knC2dIEpicN3yHehTCEA0j3 /pVi96YA3zBoPW7oy4bZvh0F4JHXdR+zm/GqIYEI4aWOe7EX5cbx1EZS7AvG79FnWCyF 8uIvqoTwBcueBg30udgHH1vxv8pVIpQPUZuSGKt/aqDNrhqCn/+sJP4pnHVIvxneRb6K UEZQ== 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; bh=7XWeqlo+6lwHoVaCLUge+Tebs94xhxS3Zq6e11aLK7U=; b=TU3tmU7olAh7ItMdMWDGUlShhjkUOIQB1A23aAqEgZwOPKL0SgT9xYsfIdO4Rws6M1 syLP3NlXyUZpQkDUfD+3BKV5knKEqy68Kol+6ONCfOWCGptzQA7c7u4FvTrJf+5bGLEG bm5+OH69TkQs1Hr0uajnpiY1y/wduys/B81YkabJz9JLzyxaut0FnOow2KqhGOlf1fEW ysbZmutba1H88UMIT/OBOTIaKOzcGIMxGSWcnmmqUrQuLcWpbyN3qX6IHMEc/kJ+XBjs ceFnzQ//GWMq/UOAWOIHW4rbVBIsuLBZ/XEz83BAcM6atVmBkfjomo5nXjCZEc8Rnqex MBAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="eCSpQ/1m"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o21si2760943pgj.415.2018.11.13.00.37.00; Tue, 13 Nov 2018 00:37:15 -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=@gmail.com header.s=20161025 header.b="eCSpQ/1m"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731257AbeKMSdj (ORCPT + 99 others); Tue, 13 Nov 2018 13:33:39 -0500 Received: from mail-it1-f196.google.com ([209.85.166.196]:52102 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730736AbeKMSdj (ORCPT ); Tue, 13 Nov 2018 13:33:39 -0500 Received: by mail-it1-f196.google.com with SMTP id m34-v6so16893085iti.1 for ; Tue, 13 Nov 2018 00:36:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7XWeqlo+6lwHoVaCLUge+Tebs94xhxS3Zq6e11aLK7U=; b=eCSpQ/1mLuWyKTCjy2uBcgud6vismnEyRTCrv2xi5jErbTwCEs3l0m5bLsjvxndex3 XIX2aKP21RPzZHBfGPdbHBfAwRdmh0wtdjkRRiwUMs96kFjQunMz1WtSa5/yJ2cghg0Z 78Fo9Bsamwc5PY8mCnInEgCjRT74bnEEKDGeBkaX85FGCfhwgx9mWUrs+xgEHzwJ6npp omY9Q91hMCfIoGu7snbEJmhTKNb6xQBvYcStnru1pNTUUzZQ+yVe3wmn7e7apfWhw/nZ NBPQKPrKGohR8IuhuNiLNsGyxUT+zLEwf/0jaNJ60teSUQL8b/86eMy7ko1CVlmuE9M5 zVSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7XWeqlo+6lwHoVaCLUge+Tebs94xhxS3Zq6e11aLK7U=; b=D+5lFbC5ehfsUqg5zhw7gv+TaYJecjPin5763MffON6CnTFBdYhFfvAmjjoRNvk4q4 rjgp1jczkd5nNjDzGREbLxap6E3AkZjtx3TnVm+rd5cpOzi8Pvo8fXIYYdxo6Lo4B45q f+uahuoTRiiaoOJ5ULMGAVvzAhzVD81P7bR6J4eYp3/RG21fwAflINZkyj42+sxBkhIT 3G2/du9JjspEkYnnJs01jhQsPTZXBETXa550wV3OxQBl1oNFy0pS6iYqxU6Kw0Hu4Wgk wsIsi0bJ2Vakapkf76AIZ030xRro6wVq698k0Mej6vQNzy7jrHUZazUw4HkAVz3GW+mj 3+QQ== X-Gm-Message-State: AGRZ1gJ6I1uEh1KMCotWgsrInElNu1dOLQOiE63UIGG4UGXCgt3bs4m2 9B+mR2w4gdQGHqaJwQTkXwT15B0qQZR905APvuL7lbF/cA4= X-Received: by 2002:a02:a0c9:: with SMTP id i9-v6mr3906372jah.116.1542098195925; Tue, 13 Nov 2018 00:36:35 -0800 (PST) MIME-Version: 1.0 References: <20181109183436.GA45531@google.com> <20181110.085826.230851261@genki.is> <20181110.201050.925673938@genki.is> <20181111.174140.002789201@genki.is> <20181113000938.GA16783@google.com> In-Reply-To: <20181113000938.GA16783@google.com> From: Alexander Kapshuk Date: Tue, 13 Nov 2018 10:35:59 +0200 Message-ID: Subject: Re: [PATCH] scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks To: Brian Norris Cc: sky@genki.is, schwab@linux-m68k.org, Masahiro Yamada , Douglas Anderson , Guenter Roeck , lists@nerdbynature.de, linux-kernel 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 Tue, Nov 13, 2018 at 2:09 AM Brian Norris wrote: > > On Mon, Nov 12, 2018 at 10:42:26AM +0200, Alexander Kapshuk wrote: > > An even simpler approach would be: > > > > { > > git --no-optional-locks status -uno --porcelain 2>/dev/null || > > git diff-index --name-only HEAD > > } | grep -qv scripts/package && > > printf '%s' -dirty > > > > Sample run: > > cmd > > sh: cmd: command not found > > > > { > > cmd 2>/dev/null || > > date > > } | grep -q 2018 && > > printf '%s' ok > > ok > > You lose accuracy here, because now you're skipping any line that > contains 'scripts/package', which would include, e.g., paths like > > tools/some/other-scripts/package > > Maybe if the grep expression were more like this? > > grep -qv '^\(.. \)\?scripts/package' > > I think it'd be safe enough to ignore paths that start with two > characters and a space, like: > > xy scripts/package > x/ scripts/package > > Brian Thanks for your input. I've found the following grep command, that uses extended regular expressions, to work as required: { echo hello echo scripts/package echo '.. scripts/package' echo tools/some/other-scripts/package } | grep -Ev '^(.. )?scripts/package' [Output] hello tools/some/other-scripts/package If the participants of this email exchange consider the proposed implementation as fitting the bill, { git --no-optional-locks status -uno --porcelain 2>/dev/null || git diff-index --name-only HEAD } | grep -Eqv '^(.. )?scripts/package' && printf '%s' -dirty Was the original committer of the patch proposed here, https://lkml.org/lkml/2018/11/10/55, going to take it in, and resend it as v2 of the patch, or did you want me to submit the patch instead? I would be happy with either way. Thanks.