@@ -226,6 +226,25 @@ proc seemsLikeRevision(version: string): bool =
226226 return false
227227 return true
228228
229+ proc extractPackageName * (url: string ): string =
230+ # # Extracts package name from repository URL.
231+ # #
232+ # # For example:
233+ # # "https://github.com/nim-lang/nimble.git" -> "nimble"
234+ # # "https://gitlab.com/user/mypackage" -> "mypackage"
235+ # # "git://example.com/foo/bar.git" -> "bar"
236+ let cleanUrl = removeTrailingGitString (url)
237+ let lastSlash = cleanUrl.rfind ('/' )
238+ if lastSlash >= 0 and lastSlash < cleanUrl.len - 1 :
239+ result = cleanUrl[lastSlash + 1 .. ^ 1 ]
240+ else :
241+ # Fallback to the whole URL if no slash found
242+ result = cleanUrl
243+ # Remove any remaining extensions like .tar.gz
244+ let dotPos = result .find ('.' )
245+ if dotPos > 0 :
246+ result = result [0 ..< dotPos]
247+
229248proc extractOwnerAndRepo (url: string ): string =
230249 # # Extracts owner and repository string from an URL to GitHub repository.
231250 # #
@@ -425,7 +444,8 @@ proc doDownload(url, downloadDir: string, verRange: VersionRange,
425444 doClone (downMethod, url, downloadDir, latest.tag,
426445 onlyTip = not options.forceFullClone, options = options)
427446 else :
428- display (" Warning:" , " The package has no tagged releases, downloading HEAD instead." , Warning ,
447+ let pkgName = extractPackageName (url)
448+ display (" Warning:" , " The package '" & pkgName & " ' has no tagged releases, downloading HEAD instead." , Warning ,
429449 priority = HighPriority )
430450 if downloadTarball (url, options):
431451 result .vcsRevision = doDownloadTarball (url, downloadDir, " HEAD" , true )
@@ -444,7 +464,8 @@ proc doDownload(url, downloadDir: string, verRange: VersionRange,
444464 priority = MediumPriority )
445465 doCheckout (downMethod, downloadDir, latest.tag, options = options)
446466 else :
447- display (" Warning:" , " The package has no tagged releases, downloading HEAD instead." , Warning ,
467+ let pkgName = extractPackageName (url)
468+ display (" Warning:" , " The package '" & pkgName & " ' has no tagged releases, downloading HEAD instead." , Warning ,
448469 priority = HighPriority )
449470
450471 if result .vcsRevision == notSetSha1Hash:
0 commit comments