sgit-lstree 419 B

12345678910111213
  1. #! /bin/bash
  2. [[ $# -ne 1 ]] && echo "Usage: $0 SHA1SUM
  3. Lists sha1 information for objects contained in tree associated with SHA1SUM." && exit 1
  4. sha=$1
  5. [[ ! -f "$(sgit-loc $sha)" ]] && echo "No object is associated with sha1sum $sha." && exit 1
  6. [[ "x$(sgit-type $sha)" != "xtree" ]] && echo "Object with sha1sum $sha is not a tree." && exit 1
  7. sgit-cat $sha | tail --lines=+3 | cut -c1-20 | xxd -p -c21 | cut -c1-40