Traceback in git module when version checkout fails

"UnboundLocalError: local variable 'branch' referenced before assignment" is
raised in git, line 282, in switch_version.

Exception is raised when version is not branch and version checkout fails.
E.g. when version is nonexistant commit.

Full traceback:
```
REMOTE_MODULE git repo="ssh://xxx/xxx.git" dest="/xxx" version="a98ef5944f5fe3969accfffa40e76fb43d6b49dc"

failed to parse: Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-1375350491.22-159151807716270/git", line 1306, in <module>
    main()
  File "/root/.ansible/tmp/ansible-1375350491.22-159151807716270/git", line 364, in main
    (rc, out, err) = switch_version(git_path, module, dest, remote, version)
  File "/root/.ansible/tmp/ansible-1375350491.22-159151807716270/git", line 282, in switch_version
    module.fail_json(msg="Failed to checkout branch %s" % (branch))
UnboundLocalError: local variable 'branch' referenced before assignment
```