5 # Usage: subtree-hash ROOT_HASH [SUBDIR ...]
10 if test "$#" -eq 1; then
14 subtree_info="$(git ls-tree "$root_hash" | grep -E " $subdir\$")" || true
15 if test "$(echo "$subtree_info" | wc -l)" -ne 1; then
16 echo "Found more than one matching line in subtree $root_hash" 1>&2
20 subtree_hash="$(echo "$subtree_info" | cut -d' ' -f 3 | cut -d$'\t' -f 1)" || true
21 if test -z "$subtree_hash"; then
22 echo "Unable to find subtree hash in git output: $subtree_info" 1>&2
27 subtree_hash "$subtree_hash" "$@"