sha1-name.c: move around the collect_ambiguous() function