When a checkout is in 'detached' head mode, .git/HEAD contains a git commit reference. fetch_git_shadoesn't handle this case.
We'd like to use this feature for our codebase, but our deploy process currently uses this type of checkout.
$ git checkout --force ea0bfa7b83b5a6b816a1da0360bde4950a73fa28
Note: checking out 'ea0bfa7b83b5a6b816a1da0360bde4950a73fa28'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at ea0bfa7... [omitted]
$ python -c 'import raven; raven.fetch_git_sha(".")'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/brent/virtualenvs/Kira-Talk/lib/python2.7/site-packages/raven/versioning.py", line 42, in fetch_git_sha
raise InvalidGitRepository('Unable to find ref to head "%s" in repository' % (head,))
raven.exceptions.InvalidGitRepository: Unable to find ref to head "ea0bfa7b83b5a6b816a1da0360bde4950a73fa28" in repository
When a checkout is in 'detached' head mode,
.git/HEAD
contains a git commit reference.fetch_git_sha
doesn't handle this case.We'd like to use this feature for our codebase, but our deploy process currently uses this type of checkout.