]> arthur.barton.de Git - bup.git/blobdiff - t/git-cat-tree
Add bup get; see the documentation for further information
[bup.git] / t / git-cat-tree
index bbbfa6b43846d2f21362eb9a5941635849154768..3a12f4d1ecd83396ce7f47659e12cfe99aab4083 100755 (executable)
@@ -6,7 +6,7 @@ set -o pipefail
 
 usage() {
 cat <<EOF
-Usage: cat-git-tree ID
+Usage: cat-git-tree [--git-dir DIR] ID
 EOF
 }
 
@@ -34,11 +34,21 @@ cat-item()
     esac
 }
 
-if test $# -ne 1
-then
-    usage 1>&2
-    exit 1
-fi
+case $# in
+    1) ;;
+    3)
+        if test "$1" != --git-dir; then
+            usage 1>&2
+            exit 1
+        fi
+        export GIT_DIR="$2"
+        shift 2
+        ;;
+    *)
+        usage 1>&2
+        exit 1
+        ;;
+esac
 
 top="$1"
 type=$(git cat-file -t "$top") || exit $?