android_kernel_oneplus_msm8998/scripts
Brian Norris b3ffb896a3 scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks
[ Upstream commit ff64dd4857303dd5550faed9fd598ac90f0f2238 ]

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: Christian Kujau <lists@nerdbynature.de>
Cc: Guenter Roeck <linux@roeck-us.net>
Suggested-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
Signed-off-by: Brian Norris <briannorris@chromium.org>
Tested-by: Genki Sky <sky@genki.is>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-11-06 12:09:11 +01:00
..
basic
coccinelle fs: stream_open - opener for stream-like files so that read and write can run simultaneously without deadlock 2019-06-11 12:24:13 +02:00
dtc
gdb
genksyms genksyms: Fix segfault with invalid declarations 2018-02-25 11:03:51 +01:00
kconfig kconfig/[mn]conf: handle backspace (^H) key 2019-05-16 19:44:59 +02:00
ksymoops
mod modpost: file2alias: check prototype of handler 2019-04-27 09:34:00 +02:00
package kbuild: pkg: use --transform option to prefix paths in tar 2017-12-16 10:33:54 +01:00
selinux
tracing
.gitignore DocBook: Use a fixed encoding for output 2015-09-28 01:31:48 -06:00
analyze_suspend.py
asn1_compiler.c
bloat-o-meter scripts/bloat-o-meter: fix python3 syntax error 2016-02-25 12:01:22 -08:00
bootgraph.pl
check-lc_ctype.c DocBook: Use a fixed encoding for output 2015-09-28 01:31:48 -06:00
check_extable.sh
checkincludes.pl
checkkconfigsymbols.py
checkpatch.pl checkpatch: silence perl 5.26.0 unescaped left brace warnings 2017-07-21 07:44:57 +02:00
checkstack.pl scripts/checkstack.pl: Fix arm64 wrong or unknown architecture 2019-07-10 09:56:32 +02:00
checksyscalls.sh
checkversion.pl
cleanfile
cleanpatch
coccicheck Coccinelle: fix incorrect -include option transformation 2015-10-26 21:32:09 +01:00
config
conmakehash.c
decode_stacktrace.sh scripts/decode_stacktrace: match basepath using shell prefix operator, not regex 2019-09-16 08:13:36 +02:00
decodecode
depmod.sh kbuild: make missing $DEPMOD a Warning instead of an Error 2018-09-15 09:40:40 +02:00
diffconfig
docproc.c
export_report.pl
extract-cert.c KEYS: Remove unnecessary header #inclusions from extract-cert.c 2015-09-25 16:31:45 +01:00
extract-ikconfig
extract-module-sig.pl KEYS: Provide a script to extract a module signature 2015-10-21 15:18:36 +01:00
extract-sys-certs.pl KEYS: Provide a script to extract the sys cert list from a vmlinux file 2015-10-21 15:18:36 +01:00
extract-vmlinux
gcc-goto.sh
gcc-ld
gcc-version.sh
gcc-x86_32-has-stack-protector.sh
gcc-x86_64-has-stack-protector.sh scripts/has-stack-protector: add -fno-PIE 2016-11-26 09:54:52 +01:00
gen_initramfs_list.sh
get_maintainer.pl get_maintainer: add subsystem to reviewer output 2015-11-06 17:50:42 -08:00
gfp-translate
headerdep.pl
headers.sh
headers_check.pl
headers_install.sh
kallsyms.c kallsyms: exclude kasan local symbols on s390 2019-08-04 09:34:58 +02:00
Kbuild.include kbuild: simplify ld-option implementation 2019-05-16 19:44:43 +02:00
kernel-doc scripts/kernel-doc: Don't fail with status != 0 if error encountered with -none 2018-02-25 11:03:39 +01:00
kernel-doc-xml-ref
ld-version.sh ld-version: Fix awk regex compile failure 2016-03-16 08:43:01 -07:00
Lindent scripts/Lindent: handle missing indent gracefully 2015-09-04 16:54:41 -07:00
link-vmlinux.sh um: link with -lpthread 2016-03-03 15:07:12 -08:00
Makefile DocBook: Use a fixed encoding for output 2015-09-28 01:31:48 -06:00
Makefile.asm-generic
Makefile.build kbuild: Add support to generate LLVM assembly files 2018-11-27 16:07:58 +01:00
Makefile.clean
Makefile.dtbinst
Makefile.extrawarn Kbuild: suppress packed-not-aligned warning for default setting only 2018-12-13 09:21:28 +01:00
Makefile.fwinst
Makefile.headersinst
Makefile.help
Makefile.host
Makefile.kasan kasan: don't emit builtin calls when sanitization is off 2018-08-17 20:56:44 +02:00
Makefile.lib kbuild: fix asm-offset generation to work with clang 2018-11-27 16:07:57 +01:00
Makefile.modbuiltin
Makefile.modinst
Makefile.modpost kbuild: modpost: handle KBUILD_EXTRA_SYMBOLS only for external modules 2019-08-25 10:53:00 +02:00
Makefile.modsign
makelst
markup_oops.pl
mkcompile_h
mkmakefile
mksysmap
mkuboot.sh
mkversion
module-common.lds module: set __jump_table alignment to 8 2017-12-16 10:33:51 +01:00
namespace.pl namespace: fix namespace.pl script to support relative paths 2019-10-29 09:13:21 +01:00
objdiff
patch-kernel
pnmtologo.c
profile2linkerlist.pl
recordmcount.c ftrace/recordmcount: Work around for addition of metag magic but not relocations 2016-08-20 18:09:23 +02:00
recordmcount.h recordmcount: Fix spurious mcount entries on powerpc 2019-08-04 09:34:57 +02:00
recordmcount.pl scripts/recordmcount.pl: support data in text section on powerpc 2016-01-31 11:29:03 -08:00
setlocalversion scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks 2019-11-06 12:09:11 +01:00
show_delta
sign-file.c MODSIGN: Change from CMS to PKCS#7 signing if the openssl is too old 2015-09-25 16:31:46 +01:00
sortextable.c Revert "x86/mm: Expand the exception table logic to allow new handling options" 2016-10-31 19:56:26 -06:00
sortextable.h
spelling.txt scripts/spelling.txt: add some typo-words 2015-09-04 16:54:41 -07:00
stackdelta
stackusage
tags.sh tags: honor COMPILED_SOURCE with apart output directory 2018-04-13 19:50:18 +02:00
unifdef.c unifdef: use memcpy instead of strncpy 2018-12-13 09:21:28 +01:00
ver_linux ver_linux: proc/modules, limit text processing to 'sed' 2015-10-17 21:55:26 -07:00
xen-hypercalls.sh
xz_wrap.sh