Dont set upstream if ref is HEAD

If the ref is HEAD, the we should be in a detached HEAD, and thus don't
have a remote, so there is no point in setting this.