Import the remaining utilities.
[utils/utils.git] / ungitar
diff --git a/ungitar b/ungitar
new file mode 100755 (executable)
index 0000000..8a6d468
--- /dev/null
+++ b/ungitar
@@ -0,0 +1,19 @@
+#!/bin/bash
+# usage: ungitar foo-dir <foo.gitar
+
+set -e
+trap "echo 'Unexpected error!' 1>&2" ERR
+if ! [ -e "$1" ]; then
+       mkdir "$1"
+fi
+cd "$1"
+
+if [ -e '.git' ]; then
+       echo 'The destination directory is already a git repository!' 1>&2
+       exit 1
+fi
+trap "rm -rf .git" EXIT
+
+ftx .git
+git-read-tree master
+git-checkout-index --all --force