1515#include "filter.h"
1616
1717struct map_data {
18- const char * cvar_name ;
19- git_cvar_map * maps ;
18+ const char * name ;
19+ git_configmap * maps ;
2020 size_t map_count ;
2121 int default_value ;
2222};
@@ -29,11 +29,11 @@ struct map_data {
2929 * value is native. See gitattributes(5) for more information on
3030 * end-of-line conversion.
3131 */
32- static git_cvar_map _cvar_map_eol [] = {
33- {GIT_CVAR_FALSE , NULL , GIT_EOL_UNSET },
34- {GIT_CVAR_STRING , "lf" , GIT_EOL_LF },
35- {GIT_CVAR_STRING , "crlf" , GIT_EOL_CRLF },
36- {GIT_CVAR_STRING , "native" , GIT_EOL_NATIVE }
32+ static git_configmap _configmap_eol [] = {
33+ {GIT_CONFIGMAP_FALSE , NULL , GIT_EOL_UNSET },
34+ {GIT_CONFIGMAP_STRING , "lf" , GIT_EOL_LF },
35+ {GIT_CONFIGMAP_STRING , "crlf" , GIT_EOL_CRLF },
36+ {GIT_CONFIGMAP_STRING , "native" , GIT_EOL_NATIVE }
3737};
3838
3939/*
@@ -46,55 +46,55 @@ static git_cvar_map _cvar_map_eol[] = {
4646 * does not have normalized line endings. This variable can be set to input,
4747 * in which case no output conversion is performed.
4848 */
49- static git_cvar_map _cvar_map_autocrlf [] = {
50- {GIT_CVAR_FALSE , NULL , GIT_AUTO_CRLF_FALSE },
51- {GIT_CVAR_TRUE , NULL , GIT_AUTO_CRLF_TRUE },
52- {GIT_CVAR_STRING , "input" , GIT_AUTO_CRLF_INPUT }
49+ static git_configmap _configmap_autocrlf [] = {
50+ {GIT_CONFIGMAP_FALSE , NULL , GIT_AUTO_CRLF_FALSE },
51+ {GIT_CONFIGMAP_TRUE , NULL , GIT_AUTO_CRLF_TRUE },
52+ {GIT_CONFIGMAP_STRING , "input" , GIT_AUTO_CRLF_INPUT }
5353};
5454
55- static git_cvar_map _cvar_map_safecrlf [] = {
56- {GIT_CVAR_FALSE , NULL , GIT_SAFE_CRLF_FALSE },
57- {GIT_CVAR_TRUE , NULL , GIT_SAFE_CRLF_FAIL },
58- {GIT_CVAR_STRING , "warn" , GIT_SAFE_CRLF_WARN }
55+ static git_configmap _configmap_safecrlf [] = {
56+ {GIT_CONFIGMAP_FALSE , NULL , GIT_SAFE_CRLF_FALSE },
57+ {GIT_CONFIGMAP_TRUE , NULL , GIT_SAFE_CRLF_FAIL },
58+ {GIT_CONFIGMAP_STRING , "warn" , GIT_SAFE_CRLF_WARN }
5959};
6060
61- static git_cvar_map _cvar_map_logallrefupdates [] = {
62- {GIT_CVAR_FALSE , NULL , GIT_LOGALLREFUPDATES_FALSE },
63- {GIT_CVAR_TRUE , NULL , GIT_LOGALLREFUPDATES_TRUE },
64- {GIT_CVAR_STRING , "always" , GIT_LOGALLREFUPDATES_ALWAYS },
61+ static git_configmap _configmap_logallrefupdates [] = {
62+ {GIT_CONFIGMAP_FALSE , NULL , GIT_LOGALLREFUPDATES_FALSE },
63+ {GIT_CONFIGMAP_TRUE , NULL , GIT_LOGALLREFUPDATES_TRUE },
64+ {GIT_CONFIGMAP_STRING , "always" , GIT_LOGALLREFUPDATES_ALWAYS },
6565};
6666
6767/*
6868 * Generic map for integer values
6969 */
70- static git_cvar_map _cvar_map_int [] = {
71- {GIT_CVAR_INT32 , NULL , 0 },
70+ static git_configmap _configmap_int [] = {
71+ {GIT_CONFIGMAP_INT32 , NULL , 0 },
7272};
7373
74- static struct map_data _cvar_maps [] = {
75- {"core.autocrlf" , _cvar_map_autocrlf , ARRAY_SIZE (_cvar_map_autocrlf ), GIT_AUTO_CRLF_DEFAULT },
76- {"core.eol" , _cvar_map_eol , ARRAY_SIZE (_cvar_map_eol ), GIT_EOL_DEFAULT },
74+ static struct map_data _configmaps [] = {
75+ {"core.autocrlf" , _configmap_autocrlf , ARRAY_SIZE (_configmap_autocrlf ), GIT_AUTO_CRLF_DEFAULT },
76+ {"core.eol" , _configmap_eol , ARRAY_SIZE (_configmap_eol ), GIT_EOL_DEFAULT },
7777 {"core.symlinks" , NULL , 0 , GIT_SYMLINKS_DEFAULT },
7878 {"core.ignorecase" , NULL , 0 , GIT_IGNORECASE_DEFAULT },
7979 {"core.filemode" , NULL , 0 , GIT_FILEMODE_DEFAULT },
8080 {"core.ignorestat" , NULL , 0 , GIT_IGNORESTAT_DEFAULT },
8181 {"core.trustctime" , NULL , 0 , GIT_TRUSTCTIME_DEFAULT },
82- {"core.abbrev" , _cvar_map_int , 1 , GIT_ABBREV_DEFAULT },
82+ {"core.abbrev" , _configmap_int , 1 , GIT_ABBREV_DEFAULT },
8383 {"core.precomposeunicode" , NULL , 0 , GIT_PRECOMPOSE_DEFAULT },
84- {"core.safecrlf" , _cvar_map_safecrlf , ARRAY_SIZE (_cvar_map_safecrlf ), GIT_SAFE_CRLF_DEFAULT },
85- {"core.logallrefupdates" , _cvar_map_logallrefupdates , ARRAY_SIZE (_cvar_map_logallrefupdates ), GIT_LOGALLREFUPDATES_DEFAULT },
84+ {"core.safecrlf" , _configmap_safecrlf , ARRAY_SIZE (_configmap_safecrlf ), GIT_SAFE_CRLF_DEFAULT },
85+ {"core.logallrefupdates" , _configmap_logallrefupdates , ARRAY_SIZE (_configmap_logallrefupdates ), GIT_LOGALLREFUPDATES_DEFAULT },
8686 {"core.protecthfs" , NULL , 0 , GIT_PROTECTHFS_DEFAULT },
8787 {"core.protectntfs" , NULL , 0 , GIT_PROTECTNTFS_DEFAULT },
8888 {"core.fsyncobjectfiles" , NULL , 0 , GIT_FSYNCOBJECTFILES_DEFAULT },
8989};
9090
91- int git_config__cvar (int * out , git_config * config , git_cvar_cached cvar )
91+ int git_config__configmap_lookup (int * out , git_config * config , git_configmap_item item )
9292{
9393 int error = 0 ;
94- struct map_data * data = & _cvar_maps [(int )cvar ];
94+ struct map_data * data = & _configmaps [(int )item ];
9595 git_config_entry * entry ;
9696
97- if ((error = git_config__lookup_entry (& entry , config , data -> cvar_name , false)) < 0 )
97+ if ((error = git_config__lookup_entry (& entry , config , data -> name , false)) < 0 )
9898 return error ;
9999
100100 if (!entry )
@@ -109,29 +109,29 @@ int git_config__cvar(int *out, git_config *config, git_cvar_cached cvar)
109109 return error ;
110110}
111111
112- int git_repository__cvar (int * out , git_repository * repo , git_cvar_cached cvar )
112+ int git_repository__configmap_lookup (int * out , git_repository * repo , git_configmap_item item )
113113{
114- * out = repo -> cvar_cache [(int )cvar ];
114+ * out = repo -> configmap_cache [(int )item ];
115115
116- if (* out == GIT_CVAR_NOT_CACHED ) {
116+ if (* out == GIT_CONFIGMAP_NOT_CACHED ) {
117117 int error ;
118118 git_config * config ;
119119
120120 if ((error = git_repository_config__weakptr (& config , repo )) < 0 ||
121- (error = git_config__cvar (out , config , cvar )) < 0 )
121+ (error = git_config__configmap_lookup (out , config , item )) < 0 )
122122 return error ;
123123
124- repo -> cvar_cache [(int )cvar ] = * out ;
124+ repo -> configmap_cache [(int )item ] = * out ;
125125 }
126126
127127 return 0 ;
128128}
129129
130- void git_repository__cvar_cache_clear (git_repository * repo )
130+ void git_repository__configmap_lookup_cache_clear (git_repository * repo )
131131{
132132 int i ;
133133
134- for (i = 0 ; i < GIT_CVAR_CACHE_MAX ; ++ i )
135- repo -> cvar_cache [i ] = GIT_CVAR_NOT_CACHED ;
134+ for (i = 0 ; i < GIT_CONFIGMAP_CACHE_MAX ; ++ i )
135+ repo -> configmap_cache [i ] = GIT_CONFIGMAP_NOT_CACHED ;
136136}
137137
0 commit comments