From: Ariel Marcovitch Date: Wed, 1 Sep 2021 14:52:12 +0000 (+0300) Subject: checkkconfigsymbols.py: Forbid passing 'HEAD' to --commit X-Git-Tag: accepted/tizen/unified/20230118.172025~6326^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d62d5aed3354ae57d57fae1e59948913f360d4eb;p=platform%2Fkernel%2Flinux-rpi.git checkkconfigsymbols.py: Forbid passing 'HEAD' to --commit As opposed to the --diff option, --commit can get ref names instead of commit hashes. When using the --commit option, the script resets the working directory to the commit before the given ref, by adding '~' to the end of the ref. However, the 'HEAD' ref is relative, and so when the working directory is reset to 'HEAD~', 'HEAD' points to what was 'HEAD~'. Then when the script resets to 'HEAD' it actually stays in the same commit. In this case, the script won't report any cases because there is no diff between the cases of the two refs. Prevent the user from using HEAD refs. A better solution might be to resolve the refs before doing the reset, but for now just disallow such refs. Signed-off-by: Ariel Marcovitch Signed-off-by: Masahiro Yamada --- diff --git a/scripts/checkkconfigsymbols.py b/scripts/checkkconfigsymbols.py index b9b0f15..c57c990 100755 --- a/scripts/checkkconfigsymbols.py +++ b/scripts/checkkconfigsymbols.py @@ -102,6 +102,9 @@ def parse_options(): "continue.") if args.commit: + if args.commit.startswith('HEAD'): + sys.exit("The --commit option can't use the HEAD ref") + args.find = False if args.ignore: