#33 Fix removal of `.git` suffix.
Merged 2 years ago by ngompa. Opened 2 years ago by qulogic.
qulogic/go-rpm-macros fix-git-suffix  into  master

file modified
+1 -1
@@ -28,7 +28,7 @@ 

    -- remove eventual protocol prefix

    goname         = string.gsub(goname, "^http(s?)://",         "")

    -- remove eventual .git suffix

-   goname         = string.gsub(goname, "%.git/*",              "")

+   goname         = string.gsub(goname, "%.git/+",              "")

    -- remove eventual git. prefix

    goname         = string.gsub(goname, "^git%.",               "")

    -- remove FQDN root (.com, .org, etc)

The intention is to remove the .git that may be added to, e.g., GitHub repository URLs. If there's a /v2 or similar after, then we want to match a slash with the suffix. If the suffix is at the end, then the earlier code would have appended a slash anyway, and so we still want to match a slash.

Allowing .git without slash incorrectly catches things like the middle of code.gitea.com. Fixes #32

Pull-Request has been merged by ngompa

2 years ago
Metadata