You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

20 lines
778 B

#!/usr/bin/env bash
cd /tmp/demo
currentCommit="$(git rev-parse HEAD)"
fileName="$(echo $currentCommit | sed 's/\(..\)/\1\//')"
echo -e "\$ zlib-flate -uncompress < .git/objects/$fileName"
zlib-flate -uncompress < ".git/objects/$fileName" | tr '\000' '␀'
echo "\$ zlib-flate -uncompress < .git/objects/$fileName | sha1sum"
echo -e "$currentCommit"
currentCommitTree="$(git cat-file -p $currentCommit | grep tree | cut -d' ' -f2)"
echo "\$ git cat-file -p $(echo $currentCommitTree | grep -o '^.......') "
git -c color.ui=always cat-file -p "$currentCommitTree"
aFile="$(git cat-file -p $currentCommitTree | grep blob | head -n 1 | cut -d' ' -f3 | cut -d' ' -f1)"
echo "\$ git cat-file -p $(echo $aFile | grep -o '^.......') "
git -c color.ui=always cat-file -p "$aFile"