handle invalid commits and refs