I'm using update hook in Git to check if this push has been approved in Phabricator(By connecting to mysql). When I trying to use the second param as old commitID in update script, I always get 40 0
s like 0000000000000000000000000000000000000000
when this reference(branch) was created by git checkout -b master
and not pushed before.
But I want to get the last commitID of master to demonstrate the starting point of this reference.
like this:
last commitID of my master branch is 978881526a1be5dc49aeef93cd83679c2142eb60
I'm using master branch to checkout a new branch like this git checkout -b t1
and then I code something and commit some times, so I got a new head of branch:dfb3094b7e9f06a8bf49671b5bbab45dd5c4318e
finally, I push this branch to origin using git push origin t1
I expected to get the params of update script as below:
$1 refs/xxx/t1
$2 978881526a1be5dc49aeef93cd83679c2142eb60
$3 dfb3094b7e9f06a8bf49671b5bbab45dd5c4318e
but I got them as below:
$1 refs/xxx/t1
$2 0000000000000000000000000000000000000000
$3 dfb3094b7e9f06a8bf49671b5bbab45dd5c4318e
Does anyone know how to solve this problem?