Skip to content

Commit 0c75692

Browse files
Seija Kijingitster
authored andcommitted
merge: break out of all_strategy loop when strategy is found
Once we find a match, there is no point to try finding the second match in the inner loop. Break out of the loop once we find the first match. Signed-off-by: Seija Kijin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a38d39a commit 0c75692

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin/merge.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ static struct strategy *get_strategy(const char *name)
188188
for (i = 0; i < main_cmds.cnt; i++) {
189189
int j, found = 0;
190190
struct cmdname *ent = main_cmds.names[i];
191-
for (j = 0; j < ARRAY_SIZE(all_strategy); j++)
191+
for (j = 0; !found && j < ARRAY_SIZE(all_strategy); j++)
192192
if (!strncmp(ent->name, all_strategy[j].name, ent->len)
193193
&& !all_strategy[j].name[ent->len])
194194
found = 1;

0 commit comments

Comments
 (0)