crystal-lang / shards

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

Error when no branch is speficied #13

Closed Mparaiso closed 9 years ago

Mparaiso commented 9 years ago

Given the following shard.yml :

name: myproject
version: 0.0.1

dependencies:

    minitest: 
        github: ysbaddaden/minitest.cr

I get this error

Updating https://github.com/ysbaddaden/minitest.cr.git
Index out of bounds (IndexOutOfBounds)
*Exception@Exception#initialize<IndexOutOfBounds, String>:Array(String) +46 [36757184]
*IndexOutOfBounds#initialize<IndexOutOfBounds, String>:Array(String) +6 [36757184]
*IndexOutOfBounds::new<String>:IndexOutOfBounds +97 [36757184]
*IndexOutOfBounds::new:IndexOutOfBounds +16 [36757184]
*String#byte_slice<String, Int32, Int32>:String +756 [36757184]
*String#[]<String, Int32, Int32>:String +82 [36757184]
*String#[]<String, Range(Int32, Int32)>:String +219 [36757184]
*Shards::Package@Shards::Helpers::NaturalSort#natural_sort<Shards::Package, String, String>:Int32 +169 [36757184]
~fun_literal_26 +9 [36757184]
*Array(T)::quicksort!<Pointer(String), Int32, (String, String -> Int32)>:Nil +620 [36757184]
*Array(String)@Array(T)#sort!<Array(String), &(String, String -> Int32)>:Array(String) +49 [36757184]
*Array(String)@Array(T)#sort<Array(String), &(String, String -> Int32)>:Array(String) +37 [36757184]
*Shards::Package@Shards::Helpers::Versions#resolve_versions<Shards::Package, Array(String), Array(String)>:Array(String) +585 [36757184]
*Shards::Package#matching_versions<Shards::Package>:Array(String) +47 [36757184]
*Shards::Package#version<Shards::Package>:String +14 [36757184]
*Shards::Package#spec<Shards::Package>:Shards::Spec +35 [36757184]
*Shards::Manager#resolve<Shards::Manager, Shards::Spec>:Array(Shards::Dependency) +132 [36757184]
*Shards::Manager#resolve<Shards::Manager>:Array(Shards::Dependency) +32 [36757184]
*Shards::Commands::Update#run<Shards::Commands::Update>:Shards::Set +30 [36757184]
*Shards::Commands::update<String>:Shards::Set +14 [36757184]
*Shards::Commands::update:Shards::Set +14 [36757184]
~fun_literal_20 +220 [36757184]
*OptionParser::ParseTask#parse<OptionParser::ParseTask>:Array(String)? +717 [36757184]
*OptionParser#parse<OptionParser, Array(String)>:Array(String)? +147 [36757184]
__crystal_main +26616 [36757184]
main +35 [36757184]
__libc_start_main +245 [36757184]
_start +41 [36757184]
 +41 [36757184]

when trying to install minitest when branch is omitted. if I add branch:master it installs the dependencies.

Shards should fetch master branch if not specified.

I'm on Debian 4.7.2-5 , x86_64

ysbaddaden commented 9 years ago

It defaults to install the latest version since the default version requirement is * and eventually fallback to HEAD. But this isn't the issue here.

The bug is actually located in the NaturalSort helper —which must be failing since Crystal 0.7.4.

ysbaddaden commented 9 years ago

Thanks for reporting, this is now fixed!