You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ra...@apache.org on 2021/09/27 11:33:10 UTC

[sling-org-apache-sling-committer-cli] branch master updated: SLING-10839 - The repository name cannot be extracted from GitHub URLs

This is an automated email from the ASF dual-hosted git repository.

radu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-committer-cli.git


The following commit(s) were added to refs/heads/master by this push:
     new 83ed2ae  SLING-10839 - The repository name cannot be extracted from GitHub URLs
83ed2ae is described below

commit 83ed2aedae20655ab676a2502c55cc52bed6b54f
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Mon Sep 27 13:32:35 2021 +0200

    SLING-10839 - The repository name cannot be extracted from GitHub URLs
---
 .../java/org/apache/sling/cli/impl/ci/CIStatusValidator.java | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/sling/cli/impl/ci/CIStatusValidator.java b/src/main/java/org/apache/sling/cli/impl/ci/CIStatusValidator.java
index f363df9..9e2e924 100644
--- a/src/main/java/org/apache/sling/cli/impl/ci/CIStatusValidator.java
+++ b/src/main/java/org/apache/sling/cli/impl/ci/CIStatusValidator.java
@@ -108,9 +108,15 @@ public class CIStatusValidator {
                 log.debug("Extracted TAG: {}", tagName);
             }
             if (repositoryName != null && repositoryName.trim().length() > 0) {
-
-                repositoryName = repositoryName.substring(repositoryName.indexOf("?p=") + 3);
-                repositoryName = repositoryName.substring(0, repositoryName.indexOf(".git"));
+                if (repositoryName.startsWith("https://gitbox.apache.org/repos/asf?p=")) {
+                    repositoryName = repositoryName.substring(repositoryName.indexOf("?p=") + 3);
+                    repositoryName = repositoryName.substring(0, repositoryName.indexOf(".git"));
+                } else if (repositoryName.startsWith("https://github.com/apache/sling-")) {
+                    repositoryName = repositoryName.substring(26);
+                    if (repositoryName.contains("/")) {
+                        repositoryName = repositoryName.substring(0, repositoryName.indexOf('/'));
+                    }
+                }
                 log.debug("Extracted REPO: {}", repositoryName);
             }
             if (repositoryName != null && !repositoryName.isEmpty() && !tagName.isEmpty() && !tagName.equalsIgnoreCase("HEAD")) {