I want to calculate git SHA hash without using the git hash object function, that is I want to use the shasum function to calculate it.
I know that for the following case
body="tree 491e9405120eaaa57cce3938fd38508d85a5e08b
parent 8550f0f1a7e32fb1bb0933b0294c116a8dbe6dce
author user <me@example.com> 1390718030 +0000
committer user <me@example.com> 1390718030 +0000
This is a test"
echo $body | git hash-object -w --stdin #755481b921f13bcfd731d74287a0c5847519ee81
l=`expr ${#body} + 1`
echo -e 'blob $l\0$body' | shasum #755481b921f13bcfd731d74287a0c5847519ee81
hashes are the same. But if I use -t commit option in hash-object I get a different Hash. How can I calculate the commit hash using shasum?
git hash-object -t commit --stdin <<< "$body" #b4c45adbbe35d3d3c73de48d039a8e3038f5ec54