3 # Usage: subtree-hash ROOT_HASH [SUBDIR ...]
8 if test "$#" -eq 1; then
12 subtree_info="$(git ls-tree "$root_hash" | grep -E " $subdir\$")" || true
13 if test "$(echo "$subtree_info" | wc -l)" -ne 1; then
14 echo "Didn't find just one matching line in subtree $root_hash" 1>&2
18 subtree_hash="$(echo "$subtree_info" | cut -d' ' -f 3 | cut -d$'\t' -f 1)" || true
19 if test -z "$subtree_hash"; then
20 echo "Unable to find subtree hash in git output: $subtree_info" 1>&2
25 subtree_hash "$subtree_hash" "$@" || exit $?