Avoid stack overflows when a Gemfile has a recursive dependency

* Why would a Gemfile have a recursive dependency? I have no idea, but I
  found one in the wild.