summaryrefslogtreecommitdiff
path: root/builtin/merge.c
diff options
context:
space:
mode:
authorSeija Kijin <doremylover123@gmail.com>2023-01-09 17:34:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2023-01-13 18:24:57 (GMT)
commit0c75692ebcddb2443c5e56c68c2e0ed55dd1ae18 (patch)
tree1ea1b801de8d3311b8cdf450ec7d8fa6818b5492 /builtin/merge.c
parenta38d39a4c50d1275833aba54c4dbdfce9e2e9ca1 (diff)
downloadgit-0c75692ebcddb2443c5e56c68c2e0ed55dd1ae18.zip
git-0c75692ebcddb2443c5e56c68c2e0ed55dd1ae18.tar.gz
git-0c75692ebcddb2443c5e56c68c2e0ed55dd1ae18.tar.bz2
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 <doremylover123@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/merge.c')
-rw-r--r--builtin/merge.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/merge.c b/builtin/merge.c
index 0f093f2..74de2eb 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -188,7 +188,7 @@ static struct strategy *get_strategy(const char *name)
for (i = 0; i < main_cmds.cnt; i++) {
int j, found = 0;
struct cmdname *ent = main_cmds.names[i];
- for (j = 0; j < ARRAY_SIZE(all_strategy); j++)
+ for (j = 0; !found && j < ARRAY_SIZE(all_strategy); j++)
if (!strncmp(ent->name, all_strategy[j].name, ent->len)
&& !all_strategy[j].name[ent->len])
found = 1;