Fixing expected GIT_BRANCH environment variable behaviour

Pull request https://github.com/jenkinsci/git-plugin/pull/225 changed the behavior regarding the GIT_BRANCH environment variable. This change here fixes the behavior.
See comments and complains in Pull Request 225.