diff options
author | Jakub Kicinski <kuba@kernel.org> | 2021-02-08 18:42:12 -0800 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2021-02-24 17:55:25 +0100 |
commit | 4add6b3bdefac21dc523071c5d3520823fb4fdab (patch) | |
tree | 0f5112ade0fd4e8a30570b436db6e4d10e0e1514 | |
parent | f5ec1cf60d1ead41212f90055eb45b86784d2ec8 (diff) | |
download | pw-4add6b3bdefac21dc523071c5d3520823fb4fdab.tar.gz |
lib: add warning when prefix doesn't match tree
Sometimes one lacks sleep and accidentally applies a patch
to the wrong tree. In case such hypothetical person names
their directories by the tree name (git's default when cloning)
we can try to help out and match the tree name to current dir.
Print a red warning when current directory is a well known tree
name, and the patch has been tagged with a well known tree name
but they don't match. Recognize net and bpf with an optional
"-next" suffix.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-rw-r--r-- | lib.sh | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -94,6 +94,15 @@ pw_series_print_short() echo "WARNING: Series is not complete" normal fi + dwd=$(basename $PWD) + if [[ "$tree" =~ ^(net|bpf)(-next)?$ && + "$dwd" =~ ^(net|bpf)(-next)?$ && + "$tree" != "$dwd" ]]; then + red + bold + echo "WARNING: Applying to the wrong tree?" + normal + fi echo "-----" if [ "$cover_letter" != "null" ]; then |