remote: check for the validity of the refspec when updating FETCH_HEAD

Before trying to rtransform using the given refspec to figure out what the name of the upstream branch is on the remote, we must make sure that the target of the refspec applies to the current branch's upstream.

From #2675