From e0d81af997ba5ae033209a86e7fbad843cd90c43 Mon Sep 17 00:00:00 2001 From: aaronchen2k <462826@qq.com> Date: Thu, 16 Jan 2020 18:39:41 +0800 Subject: [PATCH] to support muti-line and more than one commands in one commit --- module/git/model.php | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/module/git/model.php b/module/git/model.php index 2adb29f9fb..c556e81345 100644 --- a/module/git/model.php +++ b/module/git/model.php @@ -392,17 +392,24 @@ class gitModel extends model { $pattern = $this->config->repo->commitCommands['entity']; $matches = array(); - preg_match($pattern, $comment,$matches); - if(count($matches) > 1) + preg_match_all($pattern, $comment,$matches); + + if(count($matches) > 1 && count($matches[1]) > 0) { - $action = $matches[1]; - $entityType = $matches[2]; - $entityIds = $matches[3]; + $i = 0; + foreach($matches[1] as $action) + { + $action = $matches[1][$i]; + $entityType = $matches[2][$i]; + $entityIds = $matches[3][$i]; - $currArr = $allCommands[$entityType][$action]; - $newArr = explode(",", $entityIds); + $currArr = $allCommands[$entityType][$action]; + $newArr = explode(",", $entityIds); - $allCommands[$entityType][$action] = array_keys(array_flip($currArr) + array_flip($newArr)); + $allCommands[$entityType][$action] = array_keys(array_flip($currArr) + array_flip($newArr)); + + $i++; + } } }