allow git.branch to return accurate information from Jenkins/Hudson jobs

It is a known issue that git.branch is not populated with the actual branch when executed within Jenkins/Hudson.

This simple patch checks to see if the current execution is within Hudson or Jenkins, and falls back to the env var, GIT_BRANCH if it is set. 

Since the Jenkins Git Plugin populates this environment variable, the "correct" value will be set.