ExternalProject: Avoid treating tags as paths during git update

The update step checked out GIT_TAG with `git checkout <tag>`, so a name
that is neither a branch nor a tag, but names a path in the checkout,
restored the files at that path and left the checkout at the previous
commit.  Pass `--` with Git 1.8.5 and later, as the download step does,
so that such a name is an error.  Git still makes a local branch for a
name that only a remote branch has.  When that checkout fails, put back
any local changes stashed for it.

Fixes: #28308
4 files changed