Fix safeguarding discard to work with package manager-based editing of multiple packages with distinct repo roots in the same namespace.