123456789101112131415 |
- #! /bin/bash
- [[ $# -ne 1 ]] && echo "Usage: $0 SHA1SUM
- Converts SHA1SUM into a git object location." && exit 1
- objdir="$PWD/.git/objects"
- sha=$1
- sha_dir="$objdir"/$(echo $sha | awk '{print substr($1,1,2)}')
- sha_file=$(echo $sha | awk '{print substr($1,3)}')
- [[ ! -f "$sha_dir"/"$sha_file" ]] && echo "Warning: no object is currently associated with $sha." 1>&2
- echo $sha_dir/$sha_file
|