-
-
Save havenwood/f5f2dbb69c2dd9008bba1f03cef03ca0 to your computer and use it in GitHub Desktop.
git cat-file commit HEAD esque
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
timezone_offset=$(git log -1 --pretty="%ad" | grep -o "\S\+$") | |
parents=($(git log -n1 --pretty="%P" HEAD)) | |
gpg_signature=$(git verify-commit HEAD 2>&1 | wc -c) | |
message=$(cat <<-END | |
tree $(git write-tree) | |
$(for parent in $parents; do; echo "parent $parent"; done) | |
author $(git log -1 --pretty="%an <%ae> %at") $timezone_offset | |
committer $(git log -1 --pretty="%cn <%ce> %ct") $timezone_offset | |
$(git log -1 --pretty="%B") | |
END | |
) | |
if (( $gpg_signature )); then | |
echo "\nerror: invalid - needs gpg signature" >&2 | |
else | |
echo -n "$message" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment