configuration: cvar -> configmap `cvar` is an unhelpful name. Refactor its usage to `configmap` for more clarity.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 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 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041
diff --git a/include/git2/config.h b/include/git2/config.h
index 0bea323..abf5bbb 100644
--- a/include/git2/config.h
+++ b/include/git2/config.h
@@ -92,20 +92,20 @@ typedef struct git_config_iterator git_config_iterator;
* Config var type
*/
typedef enum {
- GIT_CVAR_FALSE = 0,
- GIT_CVAR_TRUE = 1,
- GIT_CVAR_INT32,
- GIT_CVAR_STRING
-} git_cvar_t;
+ GIT_CONFIGMAP_FALSE = 0,
+ GIT_CONFIGMAP_TRUE = 1,
+ GIT_CONFIGMAP_INT32,
+ GIT_CONFIGMAP_STRING
+} git_configmap_t;
/**
* Mapping from config variables to values.
*/
typedef struct {
- git_cvar_t cvar_type;
+ git_configmap_t type;
const char *str_match;
int map_value;
-} git_cvar_map;
+} git_configmap;
/**
* Locate the path to the global configuration file
@@ -623,7 +623,7 @@ GIT_EXTERN(int) git_config_foreach_match(
*
* A mapping array looks as follows:
*
- * git_cvar_map autocrlf_mapping[] = {
+ * git_configmap autocrlf_mapping[] = {
* {GIT_CVAR_FALSE, NULL, GIT_AUTO_CRLF_FALSE},
* {GIT_CVAR_TRUE, NULL, GIT_AUTO_CRLF_TRUE},
* {GIT_CVAR_STRING, "input", GIT_AUTO_CRLF_INPUT},
@@ -644,7 +644,7 @@ GIT_EXTERN(int) git_config_foreach_match(
* @param out place to store the result of the mapping
* @param cfg config file to get the variables from
* @param name name of the config variable to lookup
- * @param maps array of `git_cvar_map` objects specifying the possible mappings
+ * @param maps array of `git_configmap` objects specifying the possible mappings
* @param map_n number of mapping objects in `maps`
* @return 0 on success, error code otherwise
*/
@@ -652,20 +652,20 @@ GIT_EXTERN(int) git_config_get_mapped(
int *out,
const git_config *cfg,
const char *name,
- const git_cvar_map *maps,
+ const git_configmap *maps,
size_t map_n);
/**
* Maps a string value to an integer constant
*
* @param out place to store the result of the parsing
- * @param maps array of `git_cvar_map` objects specifying the possible mappings
+ * @param maps array of `git_configmap` objects specifying the possible mappings
* @param map_n number of mapping objects in `maps`
* @param value value to parse
*/
GIT_EXTERN(int) git_config_lookup_map_value(
int *out,
- const git_cvar_map *maps,
+ const git_configmap *maps,
size_t map_n,
const char *value);
diff --git a/src/checkout.c b/src/checkout.c
index 143b5f5..730ec62 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -1391,7 +1391,7 @@ static bool should_remove_existing(checkout_data *data)
{
int ignorecase;
- if (git_repository__cvar(&ignorecase, data->repo, GIT_CVAR_IGNORECASE) < 0) {
+ if (git_repository__configmap_lookup(&ignorecase, data->repo, GIT_CONFIGMAP_IGNORECASE) < 0) {
ignorecase = 0;
}
@@ -2463,12 +2463,12 @@ static int checkout_data_init(
data->pfx = git_pathspec_prefix(&data->opts.paths);
- if ((error = git_repository__cvar(
- &data->can_symlink, repo, GIT_CVAR_SYMLINKS)) < 0)
+ if ((error = git_repository__configmap_lookup(
+ &data->can_symlink, repo, GIT_CONFIGMAP_SYMLINKS)) < 0)
goto cleanup;
- if ((error = git_repository__cvar(
- &data->respect_filemode, repo, GIT_CVAR_FILEMODE)) < 0)
+ if ((error = git_repository__configmap_lookup(
+ &data->respect_filemode, repo, GIT_CONFIGMAP_FILEMODE)) < 0)
goto cleanup;
if (!data->opts.baseline && !data->opts.baseline_index) {
diff --git a/src/config.c b/src/config.c
index 5519fe1..8624767 100644
--- a/src/config.c
+++ b/src/config.c
@@ -661,7 +661,7 @@ int git_config_set_string(git_config *cfg, const char *name, const char *value)
error = backend->set(backend, name, value);
if (!error && GIT_REFCOUNT_OWNER(cfg) != NULL)
- git_repository__cvar_cache_clear(GIT_REFCOUNT_OWNER(cfg));
+ git_repository__configmap_lookup_cache_clear(GIT_REFCOUNT_OWNER(cfg));
return error;
}
@@ -777,7 +777,7 @@ int git_config_get_mapped(
int *out,
const git_config *cfg,
const char *name,
- const git_cvar_map *maps,
+ const git_configmap *maps,
size_t map_n)
{
git_config_entry *entry;
@@ -1223,7 +1223,7 @@ int git_config_unlock(git_config *cfg, int commit)
int git_config_lookup_map_value(
int *out,
- const git_cvar_map *maps,
+ const git_configmap *maps,
size_t map_n,
const char *value)
{
@@ -1233,27 +1233,27 @@ int git_config_lookup_map_value(
goto fail_parse;
for (i = 0; i < map_n; ++i) {
- const git_cvar_map *m = maps + i;
+ const git_configmap *m = maps + i;
- switch (m->cvar_type) {
- case GIT_CVAR_FALSE:
- case GIT_CVAR_TRUE: {
+ switch (m->type) {
+ case GIT_CONFIGMAP_FALSE:
+ case GIT_CONFIGMAP_TRUE: {
int bool_val;
if (git__parse_bool(&bool_val, value) == 0 &&
- bool_val == (int)m->cvar_type) {
+ bool_val == (int)m->type) {
*out = m->map_value;
return 0;
}
break;
}
- case GIT_CVAR_INT32:
+ case GIT_CONFIGMAP_INT32:
if (git_config_parse_int32(out, value) == 0)
return 0;
break;
- case GIT_CVAR_STRING:
+ case GIT_CONFIGMAP_STRING:
if (strcasecmp(value, m->str_match) == 0) {
*out = m->map_value;
return 0;
@@ -1267,18 +1267,18 @@ fail_parse:
return -1;
}
-int git_config_lookup_map_enum(git_cvar_t *type_out, const char **str_out,
- const git_cvar_map *maps, size_t map_n, int enum_val)
+int git_config_lookup_map_enum(git_configmap_t *type_out, const char **str_out,
+ const git_configmap *maps, size_t map_n, int enum_val)
{
size_t i;
for (i = 0; i < map_n; i++) {
- const git_cvar_map *m = &maps[i];
+ const git_configmap *m = &maps[i];
if (m->map_value != enum_val)
continue;
- *type_out = m->cvar_type;
+ *type_out = m->type;
*str_out = m->str_match;
return 0;
}
diff --git a/src/config.h b/src/config.h
index f585511..a1d8f7d 100644
--- a/src/config.h
+++ b/src/config.h
@@ -66,18 +66,19 @@ extern int git_config__get_bool_force(
extern int git_config__get_int_force(
const git_config *cfg, const char *key, int fallback_value);
-/* API for repository cvar-style lookups from config - not cached, but
- * uses cvar value maps and fallbacks
+/* API for repository configmap-style lookups from config - not cached, but
+ * uses configmap value maps and fallbacks
*/
-extern int git_config__cvar(
- int *out, git_config *config, git_cvar_cached cvar);
+extern int git_config__configmap_lookup(
+ int *out, git_config *config, git_configmap_item item);
/**
* The opposite of git_config_lookup_map_value, we take an enum value
* and map it to the string or bool value on the config.
*/
-int git_config_lookup_map_enum(git_cvar_t *type_out, const char **str_out,
- const git_cvar_map *maps, size_t map_n, int enum_val);
+int git_config_lookup_map_enum(git_configmap_t *type_out,
+ const char **str_out, const git_configmap *maps,
+ size_t map_n, int enum_val);
/**
* Unlock the backend with the highest priority
diff --git a/src/config_cache.c b/src/config_cache.c
index 2530217..dbc463b 100644
--- a/src/config_cache.c
+++ b/src/config_cache.c
@@ -15,8 +15,8 @@
#include "filter.h"
struct map_data {
- const char *cvar_name;
- git_cvar_map *maps;
+ const char *name;
+ git_configmap *maps;
size_t map_count;
int default_value;
};
@@ -29,11 +29,11 @@ struct map_data {
* value is native. See gitattributes(5) for more information on
* end-of-line conversion.
*/
-static git_cvar_map _cvar_map_eol[] = {
- {GIT_CVAR_FALSE, NULL, GIT_EOL_UNSET},
- {GIT_CVAR_STRING, "lf", GIT_EOL_LF},
- {GIT_CVAR_STRING, "crlf", GIT_EOL_CRLF},
- {GIT_CVAR_STRING, "native", GIT_EOL_NATIVE}
+static git_configmap _configmap_eol[] = {
+ {GIT_CONFIGMAP_FALSE, NULL, GIT_EOL_UNSET},
+ {GIT_CONFIGMAP_STRING, "lf", GIT_EOL_LF},
+ {GIT_CONFIGMAP_STRING, "crlf", GIT_EOL_CRLF},
+ {GIT_CONFIGMAP_STRING, "native", GIT_EOL_NATIVE}
};
/*
@@ -46,55 +46,55 @@ static git_cvar_map _cvar_map_eol[] = {
* does not have normalized line endings. This variable can be set to input,
* in which case no output conversion is performed.
*/
-static git_cvar_map _cvar_map_autocrlf[] = {
- {GIT_CVAR_FALSE, NULL, GIT_AUTO_CRLF_FALSE},
- {GIT_CVAR_TRUE, NULL, GIT_AUTO_CRLF_TRUE},
- {GIT_CVAR_STRING, "input", GIT_AUTO_CRLF_INPUT}
+static git_configmap _configmap_autocrlf[] = {
+ {GIT_CONFIGMAP_FALSE, NULL, GIT_AUTO_CRLF_FALSE},
+ {GIT_CONFIGMAP_TRUE, NULL, GIT_AUTO_CRLF_TRUE},
+ {GIT_CONFIGMAP_STRING, "input", GIT_AUTO_CRLF_INPUT}
};
-static git_cvar_map _cvar_map_safecrlf[] = {
- {GIT_CVAR_FALSE, NULL, GIT_SAFE_CRLF_FALSE},
- {GIT_CVAR_TRUE, NULL, GIT_SAFE_CRLF_FAIL},
- {GIT_CVAR_STRING, "warn", GIT_SAFE_CRLF_WARN}
+static git_configmap _configmap_safecrlf[] = {
+ {GIT_CONFIGMAP_FALSE, NULL, GIT_SAFE_CRLF_FALSE},
+ {GIT_CONFIGMAP_TRUE, NULL, GIT_SAFE_CRLF_FAIL},
+ {GIT_CONFIGMAP_STRING, "warn", GIT_SAFE_CRLF_WARN}
};
-static git_cvar_map _cvar_map_logallrefupdates[] = {
- {GIT_CVAR_FALSE, NULL, GIT_LOGALLREFUPDATES_FALSE},
- {GIT_CVAR_TRUE, NULL, GIT_LOGALLREFUPDATES_TRUE},
- {GIT_CVAR_STRING, "always", GIT_LOGALLREFUPDATES_ALWAYS},
+static git_configmap _configmap_logallrefupdates[] = {
+ {GIT_CONFIGMAP_FALSE, NULL, GIT_LOGALLREFUPDATES_FALSE},
+ {GIT_CONFIGMAP_TRUE, NULL, GIT_LOGALLREFUPDATES_TRUE},
+ {GIT_CONFIGMAP_STRING, "always", GIT_LOGALLREFUPDATES_ALWAYS},
};
/*
* Generic map for integer values
*/
-static git_cvar_map _cvar_map_int[] = {
- {GIT_CVAR_INT32, NULL, 0},
+static git_configmap _configmap_int[] = {
+ {GIT_CONFIGMAP_INT32, NULL, 0},
};
-static struct map_data _cvar_maps[] = {
- {"core.autocrlf", _cvar_map_autocrlf, ARRAY_SIZE(_cvar_map_autocrlf), GIT_AUTO_CRLF_DEFAULT},
- {"core.eol", _cvar_map_eol, ARRAY_SIZE(_cvar_map_eol), GIT_EOL_DEFAULT},
+static struct map_data _configmaps[] = {
+ {"core.autocrlf", _configmap_autocrlf, ARRAY_SIZE(_configmap_autocrlf), GIT_AUTO_CRLF_DEFAULT},
+ {"core.eol", _configmap_eol, ARRAY_SIZE(_configmap_eol), GIT_EOL_DEFAULT},
{"core.symlinks", NULL, 0, GIT_SYMLINKS_DEFAULT },
{"core.ignorecase", NULL, 0, GIT_IGNORECASE_DEFAULT },
{"core.filemode", NULL, 0, GIT_FILEMODE_DEFAULT },
{"core.ignorestat", NULL, 0, GIT_IGNORESTAT_DEFAULT },
{"core.trustctime", NULL, 0, GIT_TRUSTCTIME_DEFAULT },
- {"core.abbrev", _cvar_map_int, 1, GIT_ABBREV_DEFAULT },
+ {"core.abbrev", _configmap_int, 1, GIT_ABBREV_DEFAULT },
{"core.precomposeunicode", NULL, 0, GIT_PRECOMPOSE_DEFAULT },
- {"core.safecrlf", _cvar_map_safecrlf, ARRAY_SIZE(_cvar_map_safecrlf), GIT_SAFE_CRLF_DEFAULT},
- {"core.logallrefupdates", _cvar_map_logallrefupdates, ARRAY_SIZE(_cvar_map_logallrefupdates), GIT_LOGALLREFUPDATES_DEFAULT},
+ {"core.safecrlf", _configmap_safecrlf, ARRAY_SIZE(_configmap_safecrlf), GIT_SAFE_CRLF_DEFAULT},
+ {"core.logallrefupdates", _configmap_logallrefupdates, ARRAY_SIZE(_configmap_logallrefupdates), GIT_LOGALLREFUPDATES_DEFAULT},
{"core.protecthfs", NULL, 0, GIT_PROTECTHFS_DEFAULT },
{"core.protectntfs", NULL, 0, GIT_PROTECTNTFS_DEFAULT },
{"core.fsyncobjectfiles", NULL, 0, GIT_FSYNCOBJECTFILES_DEFAULT },
};
-int git_config__cvar(int *out, git_config *config, git_cvar_cached cvar)
+int git_config__configmap_lookup(int *out, git_config *config, git_configmap_item item)
{
int error = 0;
- struct map_data *data = &_cvar_maps[(int)cvar];
+ struct map_data *data = &_configmaps[(int)item];
git_config_entry *entry;
- if ((error = git_config__lookup_entry(&entry, config, data->cvar_name, false)) < 0)
+ if ((error = git_config__lookup_entry(&entry, config, data->name, false)) < 0)
return error;
if (!entry)
@@ -109,29 +109,29 @@ int git_config__cvar(int *out, git_config *config, git_cvar_cached cvar)
return error;
}
-int git_repository__cvar(int *out, git_repository *repo, git_cvar_cached cvar)
+int git_repository__configmap_lookup(int *out, git_repository *repo, git_configmap_item item)
{
- *out = repo->cvar_cache[(int)cvar];
+ *out = repo->configmap_cache[(int)item];
- if (*out == GIT_CVAR_NOT_CACHED) {
+ if (*out == GIT_CONFIGMAP_NOT_CACHED) {
int error;
git_config *config;
if ((error = git_repository_config__weakptr(&config, repo)) < 0 ||
- (error = git_config__cvar(out, config, cvar)) < 0)
+ (error = git_config__configmap_lookup(out, config, item)) < 0)
return error;
- repo->cvar_cache[(int)cvar] = *out;
+ repo->configmap_cache[(int)item] = *out;
}
return 0;
}
-void git_repository__cvar_cache_clear(git_repository *repo)
+void git_repository__configmap_lookup_cache_clear(git_repository *repo)
{
int i;
- for (i = 0; i < GIT_CVAR_CACHE_MAX; ++i)
- repo->cvar_cache[i] = GIT_CVAR_NOT_CACHED;
+ for (i = 0; i < GIT_CONFIGMAP_CACHE_MAX; ++i)
+ repo->configmap_cache[i] = GIT_CONFIGMAP_NOT_CACHED;
}
diff --git a/src/crlf.c b/src/crlf.c
index 6e8eaa9..22989c1 100644
--- a/src/crlf.c
+++ b/src/crlf.c
@@ -58,7 +58,7 @@ static git_crlf_t check_crlf(const char *value)
return GIT_CRLF_UNDEFINED;
}
-static git_cvar_value check_eol(const char *value)
+static git_configmap_value check_eol(const char *value)
{
if (GIT_ATTR_IS_UNSPECIFIED(value))
;
@@ -127,7 +127,7 @@ static int text_eol_is_crlf(struct crlf_attrs *ca)
return 0;
}
-static git_cvar_value output_eol(struct crlf_attrs *ca)
+static git_configmap_value output_eol(struct crlf_attrs *ca)
{
switch (ca->crlf_action) {
case GIT_CRLF_BINARY:
@@ -293,12 +293,12 @@ static int convert_attrs(
memset(ca, 0, sizeof(struct crlf_attrs));
- if ((error = git_repository__cvar(&ca->auto_crlf,
- git_filter_source_repo(src), GIT_CVAR_AUTO_CRLF)) < 0 ||
- (error = git_repository__cvar(&ca->safe_crlf,
- git_filter_source_repo(src), GIT_CVAR_SAFE_CRLF)) < 0 ||
- (error = git_repository__cvar(&ca->core_eol,
- git_filter_source_repo(src), GIT_CVAR_EOL)) < 0)
+ if ((error = git_repository__configmap_lookup(&ca->auto_crlf,
+ git_filter_source_repo(src), GIT_CONFIGMAP_AUTO_CRLF)) < 0 ||
+ (error = git_repository__configmap_lookup(&ca->safe_crlf,
+ git_filter_source_repo(src), GIT_CONFIGMAP_SAFE_CRLF)) < 0 ||
+ (error = git_repository__configmap_lookup(&ca->core_eol,
+ git_filter_source_repo(src), GIT_CONFIGMAP_EOL)) < 0)
return error;
/* downgrade FAIL to WARN if ALLOW_UNSAFE option is used */
diff --git a/src/diff_file.c b/src/diff_file.c
index d507c75..48e95eb 100644
--- a/src/diff_file.c
+++ b/src/diff_file.c
@@ -290,8 +290,8 @@ static int diff_file_content_load_workdir_symlink(
ssize_t alloc_len, read_len;
int symlink_supported, error;
- if ((error = git_repository__cvar(
- &symlink_supported, fc->repo, GIT_CVAR_SYMLINKS)) < 0)
+ if ((error = git_repository__configmap_lookup(
+ &symlink_supported, fc->repo, GIT_CONFIGMAP_SYMLINKS)) < 0)
return -1;
if (!symlink_supported)
diff --git a/src/diff_generate.c b/src/diff_generate.c
index 001cefd..dad3c0c 100644
--- a/src/diff_generate.c
+++ b/src/diff_generate.c
@@ -472,17 +472,17 @@ static int diff_generated_apply_options(
if ((val = git_repository_config_snapshot(&cfg, repo)) < 0)
return val;
- if (!git_config__cvar(&val, cfg, GIT_CVAR_SYMLINKS) && val)
+ if (!git_config__configmap_lookup(&val, cfg, GIT_CONFIGMAP_SYMLINKS) && val)
diff->diffcaps |= GIT_DIFFCAPS_HAS_SYMLINKS;
- if (!git_config__cvar(&val, cfg, GIT_CVAR_IGNORESTAT) && val)
+ if (!git_config__configmap_lookup(&val, cfg, GIT_CONFIGMAP_IGNORESTAT) && val)
diff->diffcaps |= GIT_DIFFCAPS_IGNORE_STAT;
if ((diff->base.opts.flags & GIT_DIFF_IGNORE_FILEMODE) == 0 &&
- !git_config__cvar(&val, cfg, GIT_CVAR_FILEMODE) && val)
+ !git_config__configmap_lookup(&val, cfg, GIT_CONFIGMAP_FILEMODE) && val)
diff->diffcaps |= GIT_DIFFCAPS_TRUST_MODE_BITS;
- if (!git_config__cvar(&val, cfg, GIT_CVAR_TRUSTCTIME) && val)
+ if (!git_config__configmap_lookup(&val, cfg, GIT_CONFIGMAP_TRUSTCTIME) && val)
diff->diffcaps |= GIT_DIFFCAPS_TRUST_CTIME;
/* Don't set GIT_DIFFCAPS_USE_DEV - compile time option in core git */
diff --git a/src/diff_print.c b/src/diff_print.c
index e1a25a9..664336e 100644
--- a/src/diff_print.c
+++ b/src/diff_print.c
@@ -48,7 +48,7 @@ static int diff_print_info_init__common(
if (!pi->id_strlen) {
if (!repo)
pi->id_strlen = GIT_ABBREV_DEFAULT;
- else if (git_repository__cvar(&pi->id_strlen, repo, GIT_CVAR_ABBREV) < 0)
+ else if (git_repository__configmap_lookup(&pi->id_strlen, repo, GIT_CONFIGMAP_ABBREV) < 0)
return -1;
}
diff --git a/src/ignore.c b/src/ignore.c
index 0fdadfb..825ab3c 100644
--- a/src/ignore.c
+++ b/src/ignore.c
@@ -172,7 +172,7 @@ static int parse_ignore_file(
GIT_UNUSED(allow_macros);
- if (git_repository__cvar(&ignore_case, repo, GIT_CVAR_IGNORECASE) < 0)
+ if (git_repository__configmap_lookup(&ignore_case, repo, GIT_CONFIGMAP_IGNORECASE) < 0)
git_error_clear();
/* if subdir file path, convert context for file paths */
@@ -298,8 +298,8 @@ int git_ignore__for_path(
ignores->repo = repo;
/* Read the ignore_case flag */
- if ((error = git_repository__cvar(
- &ignores->ignore_case, repo, GIT_CVAR_IGNORECASE)) < 0)
+ if ((error = git_repository__configmap_lookup(
+ &ignores->ignore_case, repo, GIT_CONFIGMAP_IGNORECASE)) < 0)
goto cleanup;
if ((error = git_attr_cache__init(repo)) < 0)
diff --git a/src/index.c b/src/index.c
index 0c90173..dc3d8f3 100644
--- a/src/index.c
+++ b/src/index.c
@@ -570,11 +570,11 @@ int git_index_set_caps(git_index *index, int caps)
return create_index_error(
-1, "cannot access repository to set index caps");
- if (!git_repository__cvar(&val, repo, GIT_CVAR_IGNORECASE))
+ if (!git_repository__configmap_lookup(&val, repo, GIT_CONFIGMAP_IGNORECASE))
index->ignore_case = (val != 0);
- if (!git_repository__cvar(&val, repo, GIT_CVAR_FILEMODE))
+ if (!git_repository__configmap_lookup(&val, repo, GIT_CONFIGMAP_FILEMODE))
index->distrust_filemode = (val == 0);
- if (!git_repository__cvar(&val, repo, GIT_CVAR_SYMLINKS))
+ if (!git_repository__configmap_lookup(&val, repo, GIT_CONFIGMAP_SYMLINKS))
index->no_symlinks = (val == 0);
}
else {
diff --git a/src/iterator.c b/src/iterator.c
index d00b8aa..3cfbd1f 100644
--- a/src/iterator.c
+++ b/src/iterator.c
@@ -145,7 +145,7 @@ static int iterator_init_common(
(iter->flags & GIT_ITERATOR_PRECOMPOSE_UNICODE) == 0 &&
(iter->flags & GIT_ITERATOR_DONT_PRECOMPOSE_UNICODE) == 0) {
- if (git_repository__cvar(&precompose, repo, GIT_CVAR_PRECOMPOSE) < 0)
+ if (git_repository__configmap_lookup(&precompose, repo, GIT_CONFIGMAP_PRECOMPOSE) < 0)
git_error_clear();
else if (precompose)
iter->flags |= GIT_ITERATOR_PRECOMPOSE_UNICODE;
diff --git a/src/object.c b/src/object.c
index 17b9794..c28629c 100644
--- a/src/object.c
+++ b/src/object.c
@@ -496,7 +496,7 @@ int git_object_short_id(git_buf *out, const git_object *obj)
git_buf_sanitize(out);
repo = git_object_owner(obj);
- if ((error = git_repository__cvar(&len, repo, GIT_CVAR_ABBREV)) < 0)
+ if ((error = git_repository__configmap_lookup(&len, repo, GIT_CONFIGMAP_ABBREV)) < 0)
return error;
if ((error = git_repository_odb(&odb, repo)) < 0)
diff --git a/src/odb.c b/src/odb.c
index e04cf02..24befad 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -666,7 +666,7 @@ int git_odb__set_caps(git_odb *odb, int caps)
return -1;
}
- if (!git_repository__cvar(&val, repo, GIT_CVAR_FSYNCOBJECTFILES))
+ if (!git_repository__configmap_lookup(&val, repo, GIT_CONFIGMAP_FSYNCOBJECTFILES))
odb->do_fsync = !!val;
}
diff --git a/src/pack-objects.c b/src/pack-objects.c
index 49ded4a..bdd5171 100644
--- a/src/pack-objects.c
+++ b/src/pack-objects.c
@@ -1397,7 +1397,7 @@ int git_packbuilder_write(
&indexer, path, mode, pb->odb, &opts) < 0)
return -1;
- if (!git_repository__cvar(&t, pb->repo, GIT_CVAR_FSYNCOBJECTFILES) && t)
+ if (!git_repository__configmap_lookup(&t, pb->repo, GIT_CONFIGMAP_FSYNCOBJECTFILES) && t)
git_indexer__set_fsync(indexer, 1);
ctx.indexer = indexer;
diff --git a/src/path.c b/src/path.c
index b1a92ae..df6b623 100644
--- a/src/path.c
+++ b/src/path.c
@@ -1832,12 +1832,12 @@ GIT_INLINE(unsigned int) dotgit_flags(
#endif
if (repo && !protectHFS)
- error = git_repository__cvar(&protectHFS, repo, GIT_CVAR_PROTECTHFS);
+ error = git_repository__configmap_lookup(&protectHFS, repo, GIT_CONFIGMAP_PROTECTHFS);
if (!error && protectHFS)
flags |= GIT_PATH_REJECT_DOT_GIT_HFS;
if (repo && !protectNTFS)
- error = git_repository__cvar(&protectNTFS, repo, GIT_CVAR_PROTECTNTFS);
+ error = git_repository__configmap_lookup(&protectNTFS, repo, GIT_CONFIGMAP_PROTECTNTFS);
if (!error && protectNTFS)
flags |= GIT_PATH_REJECT_DOT_GIT_NTFS;
diff --git a/src/refdb_fs.c b/src/refdb_fs.c
index e5ee392..09ec719 100644
--- a/src/refdb_fs.c
+++ b/src/refdb_fs.c
@@ -1104,7 +1104,7 @@ static int should_write_reflog(int *write, git_repository *repo, const char *nam
{
int error, logall;
- error = git_repository__cvar(&logall, repo, GIT_CVAR_LOGALLREFUPDATES);
+ error = git_repository__configmap_lookup(&logall, repo, GIT_CONFIGMAP_LOGALLREFUPDATES);
if (error < 0)
return error;
@@ -2114,15 +2114,15 @@ int git_refdb_backend_fs(
git_buf_dispose(&gitpath);
- if (!git_repository__cvar(&t, backend->repo, GIT_CVAR_IGNORECASE) && t) {
+ if (!git_repository__configmap_lookup(&t, backend->repo, GIT_CONFIGMAP_IGNORECASE) && t) {
backend->iterator_flags |= GIT_ITERATOR_IGNORE_CASE;
backend->direach_flags |= GIT_PATH_DIR_IGNORE_CASE;
}
- if (!git_repository__cvar(&t, backend->repo, GIT_CVAR_PRECOMPOSE) && t) {
+ if (!git_repository__configmap_lookup(&t, backend->repo, GIT_CONFIGMAP_PRECOMPOSE) && t) {
backend->iterator_flags |= GIT_ITERATOR_PRECOMPOSE_UNICODE;
backend->direach_flags |= GIT_PATH_DIR_PRECOMPOSE_UNICODE;
}
- if ((!git_repository__cvar(&t, backend->repo, GIT_CVAR_FSYNCOBJECTFILES) && t) ||
+ if ((!git_repository__configmap_lookup(&t, backend->repo, GIT_CONFIGMAP_FSYNCOBJECTFILES) && t) ||
git_repository__fsync_gitdir)
backend->fsync = 1;
backend->iterator_flags |= GIT_ITERATOR_DESCEND_SYMLINKS;
diff --git a/src/refs.c b/src/refs.c
index dce9e79..fd407b3 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -188,7 +188,7 @@ static int reference_normalize_for_repo(
int precompose;
unsigned int flags = GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL;
- if (!git_repository__cvar(&precompose, repo, GIT_CVAR_PRECOMPOSE) &&
+ if (!git_repository__configmap_lookup(&precompose, repo, GIT_CONFIGMAP_PRECOMPOSE) &&
precompose)
flags |= GIT_REFERENCE_FORMAT__PRECOMPOSE_UNICODE;
diff --git a/src/repository.c b/src/repository.c
index 71386d6..d8eb4ba 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -122,7 +122,7 @@ static void set_config(git_repository *repo, git_config *config)
git_config_free(config);
}
- git_repository__cvar_cache_clear(repo);
+ git_repository__configmap_lookup_cache_clear(repo);
}
static void set_index(git_repository *repo, git_index *index)
@@ -239,8 +239,8 @@ static git_repository *repository_alloc(void)
if (!repo->reserved_names.ptr)
goto on_error;
- /* set all the entries in the cvar cache to `unset` */
- git_repository__cvar_cache_clear(repo);
+ /* set all the entries in the configmap cache to `unset` */
+ git_repository__configmap_lookup_cache_clear(repo);
return repo;
@@ -1287,8 +1287,8 @@ bool git_repository__reserved_names(
int (*prefixcmp)(const char *, const char *);
int error, ignorecase;
- error = git_repository__cvar(
- &ignorecase, repo, GIT_CVAR_IGNORECASE);
+ error = git_repository__configmap_lookup(
+ &ignorecase, repo, GIT_CONFIGMAP_IGNORECASE);
prefixcmp = (error || ignorecase) ? git__prefixcmp_icase :
git__prefixcmp;
@@ -1660,7 +1660,7 @@ int git_repository_reinit_filesystem(git_repository *repo, int recurse)
git_config_free(config);
git_buf_dispose(&path);
- git_repository__cvar_cache_clear(repo);
+ git_repository__configmap_lookup_cache_clear(repo);
if (!repo->is_bare && recurse)
(void)git_submodule_foreach(repo, repo_reinit_submodule_fs, NULL);
diff --git a/src/repository.h b/src/repository.h
index 450a8bf..1e02bcc 100644
--- a/src/repository.h
+++ b/src/repository.h
@@ -37,34 +37,34 @@ extern bool git_repository__fsync_gitdir;
/** Cvar cache identifiers */
typedef enum {
- GIT_CVAR_AUTO_CRLF = 0, /* core.autocrlf */
- GIT_CVAR_EOL, /* core.eol */
- GIT_CVAR_SYMLINKS, /* core.symlinks */
- GIT_CVAR_IGNORECASE, /* core.ignorecase */
- GIT_CVAR_FILEMODE, /* core.filemode */
- GIT_CVAR_IGNORESTAT, /* core.ignorestat */
- GIT_CVAR_TRUSTCTIME, /* core.trustctime */
- GIT_CVAR_ABBREV, /* core.abbrev */
- GIT_CVAR_PRECOMPOSE, /* core.precomposeunicode */
- GIT_CVAR_SAFE_CRLF, /* core.safecrlf */
- GIT_CVAR_LOGALLREFUPDATES, /* core.logallrefupdates */
- GIT_CVAR_PROTECTHFS, /* core.protectHFS */
- GIT_CVAR_PROTECTNTFS, /* core.protectNTFS */
- GIT_CVAR_FSYNCOBJECTFILES, /* core.fsyncObjectFiles */
- GIT_CVAR_CACHE_MAX
-} git_cvar_cached;
+ GIT_CONFIGMAP_AUTO_CRLF = 0, /* core.autocrlf */
+ GIT_CONFIGMAP_EOL, /* core.eol */
+ GIT_CONFIGMAP_SYMLINKS, /* core.symlinks */
+ GIT_CONFIGMAP_IGNORECASE, /* core.ignorecase */
+ GIT_CONFIGMAP_FILEMODE, /* core.filemode */
+ GIT_CONFIGMAP_IGNORESTAT, /* core.ignorestat */
+ GIT_CONFIGMAP_TRUSTCTIME, /* core.trustctime */
+ GIT_CONFIGMAP_ABBREV, /* core.abbrev */
+ GIT_CONFIGMAP_PRECOMPOSE, /* core.precomposeunicode */
+ GIT_CONFIGMAP_SAFE_CRLF, /* core.safecrlf */
+ GIT_CONFIGMAP_LOGALLREFUPDATES, /* core.logallrefupdates */
+ GIT_CONFIGMAP_PROTECTHFS, /* core.protectHFS */
+ GIT_CONFIGMAP_PROTECTNTFS, /* core.protectNTFS */
+ GIT_CONFIGMAP_FSYNCOBJECTFILES, /* core.fsyncObjectFiles */
+ GIT_CONFIGMAP_CACHE_MAX
+} git_configmap_item;
/**
- * CVAR value enumerations
+ * Configuration map value enumerations
*
- * These are the values that are actually stored in the cvar cache, instead
- * of their string equivalents. These values are internal and symbolic;
- * make sure that none of them is set to `-1`, since that is the unique
- * identifier for "not cached"
+ * These are the values that are actually stored in the configmap cache,
+ * instead of their string equivalents. These values are internal and
+ * symbolic; make sure that none of them is set to `-1`, since that is
+ * the unique identifier for "not cached"
*/
typedef enum {
/* The value hasn't been loaded from the cache yet */
- GIT_CVAR_NOT_CACHED = -1,
+ GIT_CONFIGMAP_NOT_CACHED = -1,
/* core.safecrlf: false, 'fail', 'warn' */
GIT_SAFE_CRLF_FALSE = 0,
@@ -89,34 +89,34 @@ typedef enum {
GIT_EOL_DEFAULT = GIT_EOL_NATIVE,
/* core.symlinks: bool */
- GIT_SYMLINKS_DEFAULT = GIT_CVAR_TRUE,
+ GIT_SYMLINKS_DEFAULT = GIT_CONFIGMAP_TRUE,
/* core.ignorecase */
- GIT_IGNORECASE_DEFAULT = GIT_CVAR_FALSE,
+ GIT_IGNORECASE_DEFAULT = GIT_CONFIGMAP_FALSE,
/* core.filemode */
- GIT_FILEMODE_DEFAULT = GIT_CVAR_TRUE,
+ GIT_FILEMODE_DEFAULT = GIT_CONFIGMAP_TRUE,
/* core.ignorestat */
- GIT_IGNORESTAT_DEFAULT = GIT_CVAR_FALSE,
+ GIT_IGNORESTAT_DEFAULT = GIT_CONFIGMAP_FALSE,
/* core.trustctime */
- GIT_TRUSTCTIME_DEFAULT = GIT_CVAR_TRUE,
+ GIT_TRUSTCTIME_DEFAULT = GIT_CONFIGMAP_TRUE,
/* core.abbrev */
GIT_ABBREV_DEFAULT = 7,
/* core.precomposeunicode */
- GIT_PRECOMPOSE_DEFAULT = GIT_CVAR_FALSE,
+ GIT_PRECOMPOSE_DEFAULT = GIT_CONFIGMAP_FALSE,
/* core.safecrlf */
- GIT_SAFE_CRLF_DEFAULT = GIT_CVAR_FALSE,
+ GIT_SAFE_CRLF_DEFAULT = GIT_CONFIGMAP_FALSE,
/* core.logallrefupdates */
- GIT_LOGALLREFUPDATES_FALSE = GIT_CVAR_FALSE,
- GIT_LOGALLREFUPDATES_TRUE = GIT_CVAR_TRUE,
+ GIT_LOGALLREFUPDATES_FALSE = GIT_CONFIGMAP_FALSE,
+ GIT_LOGALLREFUPDATES_TRUE = GIT_CONFIGMAP_TRUE,
GIT_LOGALLREFUPDATES_UNSET = 2,
GIT_LOGALLREFUPDATES_ALWAYS = 3,
GIT_LOGALLREFUPDATES_DEFAULT = GIT_LOGALLREFUPDATES_UNSET,
/* core.protectHFS */
- GIT_PROTECTHFS_DEFAULT = GIT_CVAR_FALSE,
+ GIT_PROTECTHFS_DEFAULT = GIT_CONFIGMAP_FALSE,
/* core.protectNTFS */
- GIT_PROTECTNTFS_DEFAULT = GIT_CVAR_FALSE,
+ GIT_PROTECTNTFS_DEFAULT = GIT_CONFIGMAP_FALSE,
/* core.fsyncObjectFiles */
- GIT_FSYNCOBJECTFILES_DEFAULT = GIT_CVAR_FALSE,
-} git_cvar_value;
+ GIT_FSYNCOBJECTFILES_DEFAULT = GIT_CONFIGMAP_FALSE,
+} git_configmap_value;
/* internal repository init flags */
enum {
@@ -154,7 +154,7 @@ struct git_repository {
git_atomic attr_session_key;
- git_cvar_value cvar_cache[GIT_CVAR_CACHE_MAX];
+ git_configmap_value configmap_cache[GIT_CONFIGMAP_CACHE_MAX];
git_strmap *submodule_cache;
};
@@ -208,13 +208,13 @@ int git_repository_refdb__weakptr(git_refdb **out, git_repository *repo);
int git_repository_index__weakptr(git_index **out, git_repository *repo);
/*
- * CVAR cache
+ * Configuration map cache
*
* Efficient access to the most used config variables of a repository.
* The cache is cleared every time the config backend is replaced.
*/
-int git_repository__cvar(int *out, git_repository *repo, git_cvar_cached cvar);
-void git_repository__cvar_cache_clear(git_repository *repo);
+int git_repository__configmap_lookup(int *out, git_repository *repo, git_configmap_item item);
+void git_repository__configmap_lookup_cache_clear(git_repository *repo);
GIT_INLINE(int) git_repository__ensure_not_bare(
git_repository *repo,
diff --git a/src/stash.c b/src/stash.c
index c46830b..2d61e68 100644
--- a/src/stash.c
+++ b/src/stash.c
@@ -412,7 +412,7 @@ static int commit_worktree(
goto cleanup;
if ((error = git_index_new(&i_index)) < 0 ||
- (error = git_repository__cvar(&ignorecase, repo, GIT_CVAR_IGNORECASE)) < 0)
+ (error = git_repository__configmap_lookup(&ignorecase, repo, GIT_CONFIGMAP_IGNORECASE)) < 0)
goto cleanup;
git_index__set_ignore_case(i_index, ignorecase);
diff --git a/src/submodule.c b/src/submodule.c
index cb11a7c..cf89fc9 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -26,28 +26,28 @@
#define GIT_MODULES_FILE ".gitmodules"
-static git_cvar_map _sm_update_map[] = {
- {GIT_CVAR_STRING, "checkout", GIT_SUBMODULE_UPDATE_CHECKOUT},
- {GIT_CVAR_STRING, "rebase", GIT_SUBMODULE_UPDATE_REBASE},
- {GIT_CVAR_STRING, "merge", GIT_SUBMODULE_UPDATE_MERGE},
- {GIT_CVAR_STRING, "none", GIT_SUBMODULE_UPDATE_NONE},
- {GIT_CVAR_FALSE, NULL, GIT_SUBMODULE_UPDATE_NONE},
- {GIT_CVAR_TRUE, NULL, GIT_SUBMODULE_UPDATE_CHECKOUT},
+static git_configmap _sm_update_map[] = {
+ {GIT_CONFIGMAP_STRING, "checkout", GIT_SUBMODULE_UPDATE_CHECKOUT},
+ {GIT_CONFIGMAP_STRING, "rebase", GIT_SUBMODULE_UPDATE_REBASE},
+ {GIT_CONFIGMAP_STRING, "merge", GIT_SUBMODULE_UPDATE_MERGE},
+ {GIT_CONFIGMAP_STRING, "none", GIT_SUBMODULE_UPDATE_NONE},
+ {GIT_CONFIGMAP_FALSE, NULL, GIT_SUBMODULE_UPDATE_NONE},
+ {GIT_CONFIGMAP_TRUE, NULL, GIT_SUBMODULE_UPDATE_CHECKOUT},
};
-static git_cvar_map _sm_ignore_map[] = {
- {GIT_CVAR_STRING, "none", GIT_SUBMODULE_IGNORE_NONE},
- {GIT_CVAR_STRING, "untracked", GIT_SUBMODULE_IGNORE_UNTRACKED},
- {GIT_CVAR_STRING, "dirty", GIT_SUBMODULE_IGNORE_DIRTY},
- {GIT_CVAR_STRING, "all", GIT_SUBMODULE_IGNORE_ALL},
- {GIT_CVAR_FALSE, NULL, GIT_SUBMODULE_IGNORE_NONE},
- {GIT_CVAR_TRUE, NULL, GIT_SUBMODULE_IGNORE_ALL},
+static git_configmap _sm_ignore_map[] = {
+ {GIT_CONFIGMAP_STRING, "none", GIT_SUBMODULE_IGNORE_NONE},
+ {GIT_CONFIGMAP_STRING, "untracked", GIT_SUBMODULE_IGNORE_UNTRACKED},
+ {GIT_CONFIGMAP_STRING, "dirty", GIT_SUBMODULE_IGNORE_DIRTY},
+ {GIT_CONFIGMAP_STRING, "all", GIT_SUBMODULE_IGNORE_ALL},
+ {GIT_CONFIGMAP_FALSE, NULL, GIT_SUBMODULE_IGNORE_NONE},
+ {GIT_CONFIGMAP_TRUE, NULL, GIT_SUBMODULE_IGNORE_ALL},
};
-static git_cvar_map _sm_recurse_map[] = {
- {GIT_CVAR_STRING, "on-demand", GIT_SUBMODULE_RECURSE_ONDEMAND},
- {GIT_CVAR_FALSE, NULL, GIT_SUBMODULE_RECURSE_NO},
- {GIT_CVAR_TRUE, NULL, GIT_SUBMODULE_RECURSE_YES},
+static git_configmap _sm_recurse_map[] = {
+ {GIT_CONFIGMAP_STRING, "on-demand", GIT_SUBMODULE_RECURSE_ONDEMAND},
+ {GIT_CONFIGMAP_FALSE, NULL, GIT_SUBMODULE_RECURSE_NO},
+ {GIT_CONFIGMAP_TRUE, NULL, GIT_SUBMODULE_RECURSE_YES},
};
enum {
@@ -989,9 +989,9 @@ cleanup:
return error;
}
-static int write_mapped_var(git_repository *repo, const char *name, git_cvar_map *maps, size_t nmaps, const char *var, int ival)
+static int write_mapped_var(git_repository *repo, const char *name, git_configmap *maps, size_t nmaps, const char *var, int ival)
{
- git_cvar_t type;
+ git_configmap_t type;
const char *val;
if (git_config_lookup_map_enum(&type, &val, maps, nmaps, ival) < 0) {
@@ -999,7 +999,7 @@ static int write_mapped_var(git_repository *repo, const char *name, git_cvar_map
return -1;
}
- if (type == GIT_CVAR_TRUE)
+ if (type == GIT_CONFIGMAP_TRUE)
val = "true";
return write_var(repo, name, var, val);
diff --git a/tests/checkout/conflict.c b/tests/checkout/conflict.c
index 914b3c2..3ad830f 100644
--- a/tests/checkout/conflict.c
+++ b/tests/checkout/conflict.c
@@ -192,7 +192,7 @@ static void ensure_workdir_link(
{
int symlinks;
- cl_git_pass(git_repository__cvar(&symlinks, repo, GIT_CVAR_SYMLINKS));
+ cl_git_pass(git_repository__configmap_lookup(&symlinks, repo, GIT_CONFIGMAP_SYMLINKS));
if (!symlinks) {
ensure_workdir_contents(path, target);
diff --git a/tests/checkout/icase.c b/tests/checkout/icase.c
index b444878..077d24c 100644
--- a/tests/checkout/icase.c
+++ b/tests/checkout/icase.c
@@ -96,7 +96,7 @@ static int symlink_or_fake(git_repository *repo, const char *a, const char *b)
{
int symlinks;
- cl_git_pass(git_repository__cvar(&symlinks, repo, GIT_CVAR_SYMLINKS));
+ cl_git_pass(git_repository__configmap_lookup(&symlinks, repo, GIT_CONFIGMAP_SYMLINKS));
if (symlinks)
return p_symlink(a, b);
diff --git a/tests/diff/workdir.c b/tests/diff/workdir.c
index 7a045b4..8b04452 100644
--- a/tests/diff/workdir.c
+++ b/tests/diff/workdir.c
@@ -2112,7 +2112,7 @@ void test_diff_workdir__symlink_changed_on_non_symlink_platform(void)
g_repo = cl_git_sandbox_init("unsymlinked.git");
- cl_git_pass(git_repository__cvar(&symlinks, g_repo, GIT_CVAR_SYMLINKS));
+ cl_git_pass(git_repository__configmap_lookup(&symlinks, g_repo, GIT_CONFIGMAP_SYMLINKS));
if (symlinks)
cl_skip();
diff --git a/tests/index/bypath.c b/tests/index/bypath.c
index f911ffb..21d3d3e 100644
--- a/tests/index/bypath.c
+++ b/tests/index/bypath.c
@@ -338,7 +338,7 @@ void test_index_bypath__add_honors_symlink(void)
git_index_entry new_entry;
int symlinks;
- cl_git_pass(git_repository__cvar(&symlinks, g_repo, GIT_CVAR_SYMLINKS));
+ cl_git_pass(git_repository__configmap_lookup(&symlinks, g_repo, GIT_CONFIGMAP_SYMLINKS));
if (symlinks)
cl_skip();
diff --git a/tests/repo/config.c b/tests/repo/config.c
index b92d842..a397ee5 100644
--- a/tests/repo/config.c
+++ b/tests/repo/config.c
@@ -104,9 +104,9 @@ void test_repo_config__read_with_no_configs_at_all(void)
cl_assert(!git_path_isfile("empty_standard_repo/.git/config"));
cl_git_pass(git_repository_open(&repo, "empty_standard_repo"));
- git_repository__cvar_cache_clear(repo);
+ git_repository__configmap_lookup_cache_clear(repo);
val = -1;
- cl_git_pass(git_repository__cvar(&val, repo, GIT_CVAR_ABBREV));
+ cl_git_pass(git_repository__configmap_lookup(&val, repo, GIT_CONFIGMAP_ABBREV));
cl_assert_equal_i(GIT_ABBREV_DEFAULT, val);
git_repository_free(repo);
@@ -121,9 +121,9 @@ void test_repo_config__read_with_no_configs_at_all(void)
GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_SYSTEM, path.ptr));
cl_git_pass(git_repository_open(&repo, "empty_standard_repo"));
- git_repository__cvar_cache_clear(repo);
+ git_repository__configmap_lookup_cache_clear(repo);
val = -1;
- cl_git_pass(git_repository__cvar(&val, repo, GIT_CVAR_ABBREV));
+ cl_git_pass(git_repository__configmap_lookup(&val, repo, GIT_CONFIGMAP_ABBREV));
cl_assert_equal_i(10, val);
git_repository_free(repo);
@@ -136,9 +136,9 @@ void test_repo_config__read_with_no_configs_at_all(void)
GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_XDG, path.ptr));
cl_git_pass(git_repository_open(&repo, "empty_standard_repo"));
- git_repository__cvar_cache_clear(repo);
+ git_repository__configmap_lookup_cache_clear(repo);
val = -1;
- cl_git_pass(git_repository__cvar(&val, repo, GIT_CVAR_ABBREV));
+ cl_git_pass(git_repository__configmap_lookup(&val, repo, GIT_CONFIGMAP_ABBREV));
cl_assert_equal_i(20, val);
git_repository_free(repo);
@@ -151,9 +151,9 @@ void test_repo_config__read_with_no_configs_at_all(void)
GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, path.ptr));
cl_git_pass(git_repository_open(&repo, "empty_standard_repo"));
- git_repository__cvar_cache_clear(repo);
+ git_repository__configmap_lookup_cache_clear(repo);
val = -1;
- cl_git_pass(git_repository__cvar(&val, repo, GIT_CVAR_ABBREV));
+ cl_git_pass(git_repository__configmap_lookup(&val, repo, GIT_CONFIGMAP_ABBREV));
cl_assert_equal_i(30, val);
git_repository_free(repo);
@@ -162,18 +162,18 @@ void test_repo_config__read_with_no_configs_at_all(void)
cl_git_rewritefile("empty_standard_repo/.git/config", "[core]\n\tabbrev = 40\n");
cl_git_pass(git_repository_open(&repo, "empty_standard_repo"));
- git_repository__cvar_cache_clear(repo);
+ git_repository__configmap_lookup_cache_clear(repo);
val = -1;
- cl_git_pass(git_repository__cvar(&val, repo, GIT_CVAR_ABBREV));
+ cl_git_pass(git_repository__configmap_lookup(&val, repo, GIT_CONFIGMAP_ABBREV));
cl_assert_equal_i(40, val);
git_repository_free(repo);
/* with all configs but delete the files ? */
cl_git_pass(git_repository_open(&repo, "empty_standard_repo"));
- git_repository__cvar_cache_clear(repo);
+ git_repository__configmap_lookup_cache_clear(repo);
val = -1;
- cl_git_pass(git_repository__cvar(&val, repo, GIT_CVAR_ABBREV));
+ cl_git_pass(git_repository__configmap_lookup(&val, repo, GIT_CONFIGMAP_ABBREV));
cl_assert_equal_i(40, val);
cl_must_pass(p_unlink("empty_standard_repo/.git/config"));
@@ -188,9 +188,9 @@ void test_repo_config__read_with_no_configs_at_all(void)
cl_must_pass(p_unlink("alternate/3/.gitconfig"));
cl_assert(!git_path_isfile("alternate/3/.gitconfig"));
- git_repository__cvar_cache_clear(repo);
+ git_repository__configmap_lookup_cache_clear(repo);
val = -1;
- cl_git_pass(git_repository__cvar(&val, repo, GIT_CVAR_ABBREV));
+ cl_git_pass(git_repository__configmap_lookup(&val, repo, GIT_CONFIGMAP_ABBREV));
cl_assert_equal_i(40, val);
git_repository_free(repo);
@@ -200,9 +200,9 @@ void test_repo_config__read_with_no_configs_at_all(void)
cl_assert(!git_path_isfile("alternate/3/.gitconfig"));
cl_git_pass(git_repository_open(&repo, "empty_standard_repo"));
- git_repository__cvar_cache_clear(repo);
+ git_repository__configmap_lookup_cache_clear(repo);
val = -1;
- cl_git_pass(git_repository__cvar(&val, repo, GIT_CVAR_ABBREV));
+ cl_git_pass(git_repository__configmap_lookup(&val, repo, GIT_CONFIGMAP_ABBREV));
cl_assert_equal_i(7, val);
git_repository_free(repo);