Code

git-config --rename-section could rename wrong section
authorPavel Roskin <proski@gnu.org>
Sun, 4 Feb 2007 03:01:04 +0000 (22:01 -0500)
committerJunio C Hamano <junkio@cox.net>
Sun, 4 Feb 2007 05:35:22 +0000 (21:35 -0800)
The "git-config --rename-section" implementation would match sections
that are substrings of the section name to be renamed.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
config.c

index c08c66890f0162fe69452927c48d6835178ed12d..d82107124a53bca99ee65ea31dceb3871bf6796f 100644 (file)
--- a/config.c
+++ b/config.c
@@ -896,7 +896,7 @@ int git_config_rename_section(const char *old_name, const char *new_name)
                                if (buf[i] != old_name[j++])
                                        break;
                        }
-                       if (buf[i] == ']') {
+                       if (buf[i] == ']' && old_name[j] == 0) {
                                /* old_name matches */
                                ret++;
                                store.baselen = strlen(new_name);