sha1_name.c: teach get_short_sha1() a commit-only option