File tree Expand file tree Collapse file tree 1 file changed +2
-17
lines changed Expand file tree Collapse file tree 1 file changed +2
-17
lines changed Original file line number Diff line number Diff line change @@ -46,23 +46,8 @@ const (
4646
4747func GetProjectName (url string ) string {
4848 //if url = https://github.com/devtron-labs/git-sensor.git then it will return git-sensor
49- // Split the URL by dots
50- parts := strings .Split (url , "/" )
51-
52- // Extract the last part after the last slash
53- projectName := parts [len (parts )- 1 ]
54-
55- // Split the project name by dots
56- projectNameParts := strings .Split (projectName , "." )
57-
58- // Check if the last part is "git" and exclude it
59- if projectNameParts [len (projectNameParts )- 1 ] == "git" {
60- projectName = strings .Join (projectNameParts [:len (projectNameParts )- 1 ], "." )
61- } else {
62- projectName = strings .Join (projectNameParts , "." )
63- }
64-
65- return projectName
49+ url = url [strings .LastIndex (url , "/" )+ 1 :]
50+ return strings .TrimSuffix (url , ".git" )
6651}
6752func GetCheckoutPath (url string , cloneLocation string ) string {
6853 //url= https://github.com/devtron-labs/git-sensor.git cloneLocation= git-base/1/github.com/prakash100198
You can’t perform that action at this time.
0 commit comments