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]" ;;
21 if test -f "$b.tar" && test -f "$b.edit"; then
22 echo "$b.edit exists, deleting possibly-obsolete $b.tar"
30 if test -d "$b.edit"; then
31 echo "$b.edit already exists"
34 if test -f "$b.tar"; then
36 (set -e; cd "$b.tmp"; tar xf "$b.tar")
37 mv "$b.tmp/$i" "$b.edit"
48 if test -d "$b.edit"; then
50 cp -al "$b.edit" "$b.tmp/$i"
51 (set -e; cd "$b.tmp"; tar cf "$b.tmp/tar $i")
52 mv "$b.tmp/tar" "$b.tar"
56 echo "$b.tar regenerated"
59 if test -f "$b.tar"; then
60 echo "$b.tar already exists and $b.edit doesn't"
68 case "$i" in *_*.git) i="${i%_*.git}.git";; esac
69 if ! test -f "$b.tar" && ! test -f "$b.edit"; then
74 fail "unexpected situation in $b.*"
83 tryat "$pwd/git-srcs/$base"
84 tryat "$pwd/tests/git-srcs/$base"
85 fail "could not find $base..."