Extract gitref using same method as debs.