3 fail () { echo >&2 "$0: $*"; exit 1; }
6 2.edit|2.done) mode="$1"; arg="$2" ;;
7 2.-*) fail "no options understood" ;;
8 *) fail "usage: gitrepo-edit edit|done DIRECTORY" ;;
12 *.git.tar) base=${arg%.tar} ;;
13 *.git.edit) base=${arg%.edit} ;;
15 *) fail "arg must end in .git[.tar|.edit]" ;;
21 if test -f "$b.tar" && test -f "$b.edit"; then
22 echo "$b.edit exists, deleting possibly-obsolete $b.tar"
29 if test -d "$b.edit"; then
30 echo "$b.edit already exists"
33 if test -f "$b.tar"; then
35 (set -e; cd "$b.tmp"; tar xf "$b.tar")
45 if test -d "$b.edit"; then
46 (set -e; cd "$b.edit"; tar cf "$b.tmp" *)
50 echo "$b.tar regenerated"
53 if test -f "$b.tar"; then
54 echo "$b.tar already exists and $b.edit doesn't"
61 if ! test -f "$b.tar" && ! test -d "$b.edit"; then
66 fail "unexpected situation in $b.*"
75 tryat "$pwd/git-srcs/$base"
76 tryat "$pwd/tests/git-srcs/$base"
77 fail "could not find $base..."