From 93ddef3e2dd5f7f3238fad9d52e974d03c7844f2 Mon Sep 17 00:00:00 2001 From: sean Date: Fri, 5 May 2006 09:49:15 -0400 Subject: Fix for config file section parsing. Currently, if the target key has a section that matches the initial substring of another section we mistakenly believe we've found the correct section. To avoid this problem, ensure that the section lengths are identical before comparison. Signed-off-by: Sean Estabrooks Signed-off-by: Junio C Hamano --- config.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'config.c') diff --git a/config.c b/config.c index 4e1f0c2286..a3e14d76e5 100644 --- a/config.c +++ b/config.c @@ -335,8 +335,9 @@ static int store_aux(const char* key, const char* value) store.offset[store.seen] = ftell(config_file); store.state = KEY_SEEN; store.seen++; - } else if(!strncmp(key, store.key, store.baselen)) - store.state = SECTION_SEEN; + } else if (strrchr(key, '.') - key == store.baselen && + !strncmp(key, store.key, store.baselen)) + store.state = SECTION_SEEN; } return 0; } -- cgit v1.2.3 From 7ebdba614223f867d3f19963647406df1d0e5ce0 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 2 May 2006 16:58:37 +0200 Subject: repo-config: trim white-space before comment Earlier, calling git-repo-config core.hello on a .git/config like this: [core] hello = world ; a comment would yield "world " (i.e. with a trailing space). Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano (cherry picked from c1aee1fd8d94da9b3c5d2dc1d4264f7e73a58f80 commit) --- config.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'config.c') diff --git a/config.c b/config.c index a3e14d76e5..2cdf5fcab4 100644 --- a/config.c +++ b/config.c @@ -60,6 +60,12 @@ static char *parse_value(void) space = 1; continue; } + if (!quote) { + if (c == ';' || c == '#') { + comment = 1; + continue; + } + } if (space) { if (len) value[len++] = ' '; @@ -93,12 +99,6 @@ static char *parse_value(void) quote = 1-quote; continue; } - if (!quote) { - if (c == ';' || c == '#') { - comment = 1; - continue; - } - } value[len++] = c; } } -- cgit v1.2.3 From e388c7382563b7497397c78bc078d0679dc891a8 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 2 May 2006 00:40:24 -0700 Subject: core.prefersymlinkrefs: use symlinks for .git/HEAD When inspecting a project whose build infrastructure used to assume that .git/HEAD is a symlink ref, core.prefersymlinkrefs in the config file of such a project would help to bisect its history. Signed-off-by: Junio C Hamano (cherry picked from 9f0bb90d161edf8c43f5261d12bf83f14eb02ff4 commit) --- config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'config.c') diff --git a/config.c b/config.c index 2cdf5fcab4..87fb22041e 100644 --- a/config.c +++ b/config.c @@ -227,8 +227,8 @@ 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); + if (!strcmp(var, "core.prefersymlinkrefs")) { + prefer_symlink_refs = git_config_bool(var, value); return 0; } -- cgit v1.2.3