extended handling of sha and tag when head ... fix #1961