Skip to content

Instantly share code, notes, and snippets.

@motivic
Created October 27, 2016 20:50
Show Gist options
  • Select an option

  • Save motivic/c1ee9e568d9f9f5523214b72296bf789 to your computer and use it in GitHub Desktop.

Select an option

Save motivic/c1ee9e568d9f9f5523214b72296bf789 to your computer and use it in GitHub Desktop.
Print out uncompressed contents of `.git/objects`
#!/usr/bin/env bash
base_dir=".git/objects"
blue=$(tput setaf 4)
normal=$(tput sgr0)
for d in $(ls -R $base_dir); do
if [[ -d "$base_dir/$d" ]]; then
for f in $(ls -R $base_dir/$d); do
file="$base_dir/$d/$f"
if [[ -f $file ]]; then
printf "%40s" "${blue}$file${normal}"
perl -MCompress::Zlib -e 'undef $/; print "\n"; print uncompress(<>)' $file
printf "\n\n";
fi
done
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment