From: Brian Norris <briannorris@chromium.org>
To: alexander.kapshuk@gmail.com
Cc: sky@genki.is, schwab@linux-m68k.org,
yamada.masahiro@socionext.com,
Doug Anderson <dianders@chromium.org>,
Guenter Roeck <linux@roeck-us.net>,
lists@nerdbynature.de,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks
Date: Tue, 13 Nov 2018 10:32:16 -0800 [thread overview]
Message-ID: <CA+ASDXPcYp_joFeyGQ7TXFBSK-7i6bNFzaA1z=YYSDEjyMABdg@mail.gmail.com> (raw)
In-Reply-To: <CAJ1xhMVFt6bYgwY+N5VoFXNpm5kS1j_HV8-ZS8SkavNgZx1HOg@mail.gmail.com>
Hi Alexander,
On Tue, Nov 13, 2018 at 12:36 AM Alexander Kapshuk
<alexander.kapshuk@gmail.com> wrote:
>
> On Tue, Nov 13, 2018 at 2:09 AM Brian Norris <briannorris@chromium.org> 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:
Is there any good reason you switched to extended? It looks like my
(basic regex) grep was equivalent.
> {
> 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.
I can submit it. I expect Masahiro-san would prefer a proper v2 patch
for review, given how much would change from my v1.
And this time, I'll actually test it with a non-dirty tree! (Of
course, my tree is naturally dirty when developing the patch, but I
missed testing post-commit...)
Brian
next prev parent reply other threads:[~2018-11-13 18:32 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-06 18:10 [PATCH] Revert "scripts/setlocalversion: git: Make -dirty check more robust" Guenter Roeck
2018-11-06 19:23 ` Genki Sky
2018-11-07 2:22 ` Brian Norris
2018-11-07 2:58 ` Christian Kujau
2018-11-07 3:10 ` Guenter Roeck
2018-11-07 4:00 ` Brian Norris
2018-11-07 18:44 ` Brian Norris
2018-11-07 20:43 ` Genki Sky
2018-11-07 20:55 ` Guenter Roeck
2018-11-07 21:07 ` Genki Sky
2018-11-07 21:18 ` Doug Anderson
2018-11-07 21:26 ` Genki Sky
2018-11-08 3:16 ` Brian Norris
2018-11-09 2:55 ` Masahiro Yamada
2018-11-09 18:34 ` [PATCH] scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks Brian Norris
2018-11-09 20:43 ` Guenter Roeck
2018-11-10 8:58 ` Genki Sky
2018-11-10 10:42 ` Andreas Schwab
2018-11-10 20:10 ` Genki Sky
2018-11-11 14:48 ` Alexander Kapshuk
2018-11-11 15:03 ` Alexander Kapshuk
2018-11-11 17:41 ` Genki Sky
2018-11-11 19:59 ` Alexander Kapshuk
2018-11-12 8:42 ` Alexander Kapshuk
2018-11-13 0:09 ` Brian Norris
2018-11-13 8:35 ` Alexander Kapshuk
2018-11-13 18:32 ` Brian Norris [this message]
2018-11-13 19:03 ` [PATCH v2] " Brian Norris
2018-11-13 19:47 ` Genki Sky
2018-11-13 22:03 ` Andreas Schwab
2018-11-15 2:06 ` Brian Norris
2018-11-15 2:11 ` [PATCH v3] " Brian Norris
2018-11-16 15:17 ` Masahiro Yamada
2018-11-19 14:42 ` Masahiro Yamada
2018-11-13 19:15 ` [PATCH] " Alexander Kapshuk
2018-11-09 2:55 ` [PATCH] Revert "scripts/setlocalversion: git: Make -dirty check more robust" Masahiro Yamada
2018-11-09 16:39 ` Masahiro Yamada
2018-11-09 16:39 ` Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CA+ASDXPcYp_joFeyGQ7TXFBSK-7i6bNFzaA1z=YYSDEjyMABdg@mail.gmail.com' \
--to=briannorris@chromium.org \
--cc=alexander.kapshuk@gmail.com \
--cc=dianders@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=lists@nerdbynature.de \
--cc=schwab@linux-m68k.org \
--cc=sky@genki.is \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).