Skip to content

Commit d62d5ae

Browse files
arielmarco-hzmasahir0y
authored andcommitted
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 <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 6880fa6 commit d62d5ae

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

scripts/checkkconfigsymbols.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ def parse_options():
102102
"continue.")
103103

104104
if args.commit:
105+
if args.commit.startswith('HEAD'):
106+
sys.exit("The --commit option can't use the HEAD ref")
107+
105108
args.find = False
106109

107110
if args.ignore:

0 commit comments

Comments
 (0)