Commit 2229668
fix: preserve implicit boolean config keys (#2237)
This was mostly a rubber-stamp, knowing the the whole implementation is quite
a hack that is held together with ductape. Ideally, it will just work well enough
at some point, to gain time for v4 to be made.
<!-- agent -->
GitConfigParser discarded keys written without an assignment. Reading such
an option raised NoOptionError, and editing an unrelated setting silently
removed it. Git treats a bare key as true but an explicitly empty value as
false, so representing both as an empty string would lose their meaning.
Store bare entries as None, following RawConfigParser's allow_no_value
representation. Raw get/items access preserves the distinction, while
get_value/get_values return an empty string as requested. Convert None to
true and an empty string to false in getboolean, retaining the standard
boolean spellings. Write None entries without an equals sign and exclude
them from string validation and include-path expansion. The existing
ordered multi-dict preserves repeated bare and assigned entries together.
Update the regression that expected bare color.ui to disappear, and add a
Git-backed read-modify-write test covering trailing whitespace, EOF without
a newline, quoted and unquoted empty values, repeated keys, and a valueless
non-path option in an include section. Both regressions failed before the
fix. Compare Git's NUL-delimited listing before and after an unrelated edit
and check the resulting repeated values with --type=bool --get-all.
Git reference: checkout 1630431f326e15fcde608827b5ff38422528eb59,
t/t1300-config.sh tests for novalue.variable and emptyvalue.variable, and
parse.c:git_parse_maybe_bool_text. Runtime comparison used Git 2.50.1
(Apple Git-155).
Assisted-by: GPT 6.0
Co-authored-by: GPT 6.0 <codex@openai.com>1 parent a9913c7 commit 2229668
2 files changed
Lines changed: 91 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
294 | 300 | | |
295 | 301 | | |
296 | 302 | | |
| |||
348 | 354 | | |
349 | 355 | | |
350 | 356 | | |
351 | | - | |
| 357 | + | |
352 | 358 | | |
353 | 359 | | |
354 | 360 | | |
| |||
587 | 593 | | |
588 | 594 | | |
589 | 595 | | |
590 | | - | |
591 | | - | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
592 | 602 | | |
593 | 603 | | |
594 | 604 | | |
| |||
625 | 635 | | |
626 | 636 | | |
627 | 637 | | |
| 638 | + | |
628 | 639 | | |
629 | 640 | | |
630 | 641 | | |
| |||
760 | 771 | | |
761 | 772 | | |
762 | 773 | | |
763 | | - | |
764 | | - | |
| 774 | + | |
| 775 | + | |
765 | 776 | | |
766 | 777 | | |
767 | 778 | | |
768 | 779 | | |
769 | 780 | | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
770 | 784 | | |
771 | 785 | | |
772 | 786 | | |
| |||
783 | 797 | | |
784 | 798 | | |
785 | 799 | | |
786 | | - | |
| 800 | + | |
787 | 801 | | |
788 | 802 | | |
789 | 803 | | |
790 | | - | |
| 804 | + | |
791 | 805 | | |
792 | 806 | | |
793 | 807 | | |
| |||
841 | 855 | | |
842 | 856 | | |
843 | 857 | | |
| 858 | + | |
| 859 | + | |
844 | 860 | | |
845 | 861 | | |
846 | 862 | | |
| |||
877 | 893 | | |
878 | 894 | | |
879 | 895 | | |
880 | | - | |
881 | 896 | | |
882 | 897 | | |
883 | 898 | | |
| |||
894 | 909 | | |
895 | 910 | | |
896 | 911 | | |
897 | | - | |
| 912 | + | |
898 | 913 | | |
899 | 914 | | |
900 | 915 | | |
| |||
925 | 940 | | |
926 | 941 | | |
927 | 942 | | |
928 | | - | |
| 943 | + | |
929 | 944 | | |
930 | 945 | | |
931 | 946 | | |
| |||
941 | 956 | | |
942 | 957 | | |
943 | 958 | | |
944 | | - | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
945 | 972 | | |
946 | 973 | | |
947 | 974 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
864 | 864 | | |
865 | 865 | | |
866 | 866 | | |
867 | | - | |
868 | | - | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
869 | 919 | | |
870 | 920 | | |
871 | 921 | | |
| |||
0 commit comments