Recently, I have used Trac to manage a git project, and I used a git post-receive hook to sync the commit back to Trac.
The hook starts with something like this:
read oldrev newrev refname REV=$(git rev-list "$oldrev..$newrev")
/usr/local/bin/trac-admin /app/trac/trac_env changeset added $git_name $REV
It works fine for most cases, however, when I try to push a new branch to remote, the $oldrev becomes 0, and caused problem.
fatal: ambiguous argument '0..70e0844': unknown revision or path not in the working tree.
Read more A Small Git Problem
(And why I am still uncomfortable with Git)