crystal-lang / shards

Dependency manager for the Crystal language
Other
763 stars 100 forks source link

github ambiguous sources #470

Closed stakach closed 3 years ago

stakach commented 3 years ago

I'm getting some ambiguous sources errors when updating shards. I have solved the problem temporarily by using shard.override however I think there is a better way, at least for github

The issue is that two separate shards are depending on retriable

dependencies:
  retriable:
    github: Sija/retriable.cr

and

dependencies:
  retriable:
    github: sija/retriable.cr

note the difference in case on sija

However github is case insensitive when if comes to URLs so I propose that for github dependencies the URLs are downcased to avoid errors like this:

Error shard name (retriable) has ambiguous sources: 'git: https://github.com/Sija/retriable.cr.git' and 'git: https://github.com/sija/retriable.cr.git'.

which would greatly improve the experience of using shards

caspiano commented 3 years ago

Related: spider-gazelle/rethinkdb-orm/issues/14

bcardiff commented 3 years ago

Sure, this should not be detected as an ambiguous source. It can be handle in Git.normalize_key_source

Would it be enough to normalize when github: is used, or should it also be lowercased when git: https://... is used?

If so, we should not transform user/password to avoid breakinig https://<token>@github.com/owner/repo.git or https://<token>:x-oauth-basic@github.com/owner/repo.git private repos.

straight-shoota commented 3 years ago

I wouldn't downcase every http URL. Some providers may use case sensitive paths. So we should only do that when we know the provider treats it insensitive. It's easier to fix a mismatched spelling than not being able to install a dependency because it requires capital letters in the URL.

straight-shoota commented 3 years ago

But github/gitlab/bitbucket URLs on git key should get their paths normalized as well.