X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=config.c;h=915bb9752374b8d11883fbe5da976e71e1b1af60;hb=acf59575cac330f3a505247dd7a9d6551a2a9cf8;hp=f3c4fa42ac759157373885924b91a4a43f59953c;hpb=17712991a59824a8d22d5115c0c154d3122fc17b;p=git.git diff --git a/config.c b/config.c index f3c4fa42..915bb975 100644 --- a/config.c +++ b/config.c @@ -1,4 +1,3 @@ -#include #include "cache.h" @@ -14,6 +13,14 @@ static int get_next_char(void) c = '\n'; if ((f = config_file) != NULL) { c = fgetc(f); + if (c == '\r') { + /* DOS like systems */ + c = fgetc(f); + if (c != '\n') { + ungetc(c, f); + c = '\r'; + } + } if (c == '\n') config_linenr++; if (c == EOF) { @@ -64,7 +71,12 @@ static char *parse_value(void) case 'n': c = '\n'; break; - return NULL; + /* Some characters escape as themselves */ + case '\\': case '"': + break; + /* Reject unknown escape sequences */ + default: + return NULL; } value[len++] = c; continue; @@ -163,7 +175,7 @@ static int git_parse_file(config_fn_t fn) } if (!isalpha(c)) break; - var[baselen] = c; + var[baselen] = tolower(c); if (get_value(fn, var, baselen+1) < 0) break; } @@ -202,6 +214,26 @@ int git_default_config(const char *var, const char *value) return 0; } + if (!strcmp(var, "core.symrefsonly")) { + only_use_symrefs = git_config_bool(var, value); + return 0; + } + + if (!strcmp(var, "user.name")) { + strncpy(git_default_name, value, sizeof(git_default_name)); + return 0; + } + + if (!strcmp(var, "user.email")) { + strncpy(git_default_email, value, sizeof(git_default_email)); + return 0; + } + + if (!strcmp(var, "diff.renamelimit")) { + diff_rename_limit_default = git_config_int(var, value); + return 0; + } + /* Add other config variables here.. */ return 0; }