diff options
author | Junio C Hamano <junkio@cox.net> | 2007-05-13 13:34:40 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-05-13 13:34:40 -0700 |
commit | 43d151a1b087db22e2f9a754772b469de1194f67 (patch) | |
tree | 49f381570791ba6c56619bc737c78fe245a9f42e /config.c | |
parent | cvsserver: Limit config parser to needed options (diff) | |
parent | git-svn: don't attempt to minimize URLs by default (diff) | |
download | tgif-43d151a1b087db22e2f9a754772b469de1194f67.tar.xz |
Merge branch 'maint'
* maint:
git-svn: don't attempt to minimize URLs by default
git-svn: fix segfaults due to initial SVN pool being cleared
git-svn: clean up caching of SVN::Ra functions
git-svn: don't drop the username from URLs when dcommit is run
RPM spec: include files in technical/ to package.
Remove stale non-static-inline prototype for tree_entry_extract()
git-config: test for 'do not forget "a.b.var" ends "a.var" section'.
git-config: do not forget seeing "a.b.var" means we are out of "a.var" section.
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 28 |
1 files changed, 24 insertions, 4 deletions
@@ -451,6 +451,9 @@ static int matches(const char* key, const char* value) static int store_aux(const char* key, const char* value) { + const char *ep; + size_t section_len; + switch (store.state) { case KEY_SEEN: if (matches(key, value)) { @@ -468,12 +471,29 @@ static int store_aux(const char* key, const char* value) } break; case SECTION_SEEN: - if (strncmp(key, store.key, store.baselen+1)) { + /* + * What we are looking for is in store.key (both + * section and var), and its section part is baselen + * long. We found key (again, both section and var). + * We would want to know if this key is in the same + * section as what we are looking for. We already + * know we are in the same section as what should + * hold store.key. + */ + ep = strrchr(key, '.'); + section_len = ep - key; + + if ((section_len != store.baselen) || + memcmp(key, store.key, section_len+1)) { store.state = SECTION_END_SEEN; break; - } else - /* do not increment matches: this is no match */ - store.offset[store.seen] = ftell(config_file); + } + + /* + * Do not increment matches: this is no match, but we + * just made sure we are in the desired section. + */ + store.offset[store.seen] = ftell(config_file); /* fallthru */ case SECTION_END_SEEN: case START: |