builtin-merge.c: call exclude_cmds() correctly.
authorAvery Pennarun <apenwarr@gmail.com>
Thu, 26 Nov 2009 02:23:54 +0000 (21:23 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Nov 2009 02:49:11 +0000 (18:49 -0800)
We need to call exclude_cmds() after the loop, not during the loop, because
excluding a command from the array can change the indexes of objects in the
array.  The result is that, depending on file ordering, some commands
weren't excluded as they should have been.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-merge.c

index b6b84286b26a4317dfd5185ae83fd861c6f9fa7d..4bcf7c7bce9fda004fcab7cf569f886bbcb387b4 100644 (file)
@@ -106,8 +106,8 @@ static struct strategy *get_strategy(const char *name)
                                        found = 1;
                        if (!found)
                                add_cmdname(&not_strategies, ent->name, ent->len);
-                       exclude_cmds(&main_cmds, &not_strategies);
                }
+               exclude_cmds(&main_cmds, &not_strategies);
        }
        if (!is_in_cmdlist(&main_cmds, name) && !is_in_cmdlist(&other_cmds, name)) {
                fprintf(stderr, "Could not find merge strategy '%s'.\n", name);