Author: Jake Merdich Date: 2020-05-24T20:32:54-04:00 New Revision: 52b03aaa22f650bbd36ceb3bdae4699dae71b2b8
URL: https://github.com/llvm/llvm-project/commit/52b03aaa22f650bbd36ceb3bdae4699dae71b2b8 DIFF: https://github.com/llvm/llvm-project/commit/52b03aaa22f650bbd36ceb3bdae4699dae71b2b8.diff LOG: [clang-format][PR46043] Parse git config w/ implicit values Summary: https://bugs.llvm.org/show_bug.cgi?id=46043 Git's config is generally of the format 'key=val', but a setting 'key=true' can be written as just 'key'. The git-clang-format script expects a value and crashes in this case; this change handles implicit 'true' values in the script. Reviewers: MyDeveloperDay, krasimir, sammccall Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D80486 Added: Modified: clang/tools/clang-format/git-clang-format Removed: ################################################################################ diff --git a/clang/tools/clang-format/git-clang-format b/clang/tools/clang-format/git-clang-format index abbe3b7b97c6..f3cd585e7f4a 100755 --- a/clang/tools/clang-format/git-clang-format +++ b/clang/tools/clang-format/git-clang-format @@ -192,7 +192,12 @@ def load_git_config(non_string_options=None): out = {} for entry in run('git', 'config', '--list', '--null').split('\0'): if entry: - name, value = entry.split('\n', 1) + if '\n' in entry: + name, value = entry.split('\n', 1) + else: + # A setting with no '=' ('\n' with --null) is implicitly 'true' + name = entry + value = 'true' if name in non_string_options: value = run('git', 'config', non_string_options[name], name) out[name] = value _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits