Commit | Line | Data |
---|---|---|
1 | #!/bin/bash | |
2 | # usage: ungitar foo-dir <foo.gitar | |
3 | ||
4 | set -e | |
5 | trap "echo 'Unexpected error!' 1>&2" ERR | |
6 | if ! [ -e "$1" ]; then | |
7 | mkdir "$1" | |
8 | fi | |
9 | cd "$1" | |
10 | ||
11 | if [ -e '.git' ]; then | |
12 | echo 'The destination directory is already a git repository!' 1>&2 | |
13 | exit 1 | |
14 | fi | |
15 | trap "rm -rf .git" EXIT | |
16 | ||
17 | ftx .git | |
18 | git read-tree master | |
19 | git checkout-index --all --force |