projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Refactor merge strategies into separate includable file.
[git.git]
/
config.c
diff --git
a/config.c
b/config.c
index
f3c4fa4
..
e89bab2
100644
(file)
--- a/
config.c
+++ b/
config.c
@@
-1,4
+1,3
@@
-#include <ctype.h>
#include "cache.h"
#include "cache.h"
@@
-14,6
+13,14
@@
static int get_next_char(void)
c = '\n';
if ((f = config_file) != NULL) {
c = fgetc(f);
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) {
if (c == '\n')
config_linenr++;
if (c == EOF) {
@@
-64,7
+71,12
@@
static char *parse_value(void)
case 'n':
c = '\n';
break;
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;
}
value[len++] = c;
continue;
@@
-163,7
+175,7
@@
static int git_parse_file(config_fn_t fn)
}
if (!isalpha(c))
break;
}
if (!isalpha(c))
break;
- var[baselen] =
c
;
+ var[baselen] =
tolower(c)
;
if (get_value(fn, var, baselen+1) < 0)
break;
}
if (get_value(fn, var, baselen+1) < 0)
break;
}
@@
-202,6
+214,16
@@
int git_default_config(const char *var, const char *value)
return 0;
}
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;
+ }
+
/* Add other config variables here.. */
return 0;
}
/* Add other config variables here.. */
return 0;
}