glossary: more precise definition of tree-ish (a.k.a. treeish)
[gitweb.git] / git-sh-setup.sh
index 2f7835941ecaa48be17b6dd64e64fb0df3db37e2..7a964ad2ff70a8746c52ab30d945ebff95246edd 100644 (file)
@@ -313,3 +313,15 @@ then
        }
        : ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"}
 fi
+
+peel_committish () {
+       case "$1" in
+       :/*)
+               peeltmp=$(git rev-parse --verify "$1") &&
+               git rev-parse --verify "${peeltmp}^0"
+               ;;
+       *)
+               git rev-parse --verify "${1}^0"
+               ;;
+       esac
+}