From 63973c77a85e4b7ec31804b5174ab4d13b89b25b Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Thu, 2 Jun 2022 17:33:28 +0200
Subject: [PATCH] gitlab-ci-cd/drupal#28 Improve project search and error
 handling

---
 bin/merge | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bin/merge b/bin/merge
index d95cec6..d7d0aee 100755
--- a/bin/merge
+++ b/bin/merge
@@ -85,8 +85,12 @@ else
   echo "Find project ID from remote URL ..."
   # shellcheck disable=SC2001
   path="$(echo "$path" | sed -e 's,\..*,,g')"
-  gitlab 200 GET projects?search="$path"
+  gitlab 200 GET "projects?search_namespaces=1&search=$path"
   PRJID=$(echo "$result"  | jq -r .[0]."id")
+  if [[ "a${PRJID}a" == "aa" ]]; then
+    echo "No project found"
+    exit 6
+  fi
   if [[ $(isNumeric "$PRJID") -eq 1 ]]; then
     echo "Can not find project ID"
     exit 6
-- 
GitLab