Add is_valid_git_refname and is_valid_git_sha1

Should fix problem where some older versions of git would fail to retrieve the right information. 

Two functions were added to validate the output is either a valid commit number and a valid branch name.

See the discussion in issue #603.