chiark / gitweb /
tests: gitrepo-edit: wip, new .edit style
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 19 Feb 2014 21:35:27 +0000 (21:35 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 5 Mar 2014 18:29:06 +0000 (18:29 +0000)
tests/gitrepo-edit

index 27be703..b1d6077 100755 (executable)
@@ -26,7 +26,6 @@ tryat_pre () {
 
 tryat_edit () {
        local b="$1"
-       local i="$2"
        if test -d "$b.edit"; then
                echo "$b.edit already exists"
                exit 0
@@ -34,9 +33,8 @@ tryat_edit () {
        if test -f "$b.tar"; then
                mkdir "$b.tmp"
                (set -e; cd "$b.tmp"; tar xf "$b.tar")
-               mv "$b.tmp/$i" "$b.edit"
+               mv "$b.tmp" "$b.edit"
                rm "$b.tar"
-               rm -rf "$b.tmp"
                echo "$b.edit ready"
                exit 0
        fi
@@ -44,13 +42,9 @@ tryat_edit () {
 
 tryat_done () {
        local b="$1"
-       local i="$2"
        if test -d "$b.edit"; then
-               mkdir "$b.tmp"
-               cp -al "$b.edit" "$b.tmp/$i"
-               (set -e; cd "$b.tmp"; tar cf "$b.tmp/tar $i")
-               mv "$b.tmp/tar" "$b.tar"
-               rm -rf "$b.tmp"
+               (set -e; cd "$b.edit"; tar cf "$b.tmp" *)
+               mv "$b.tmp" "$b.tar"
                mv "$b.edit" "$b.tmp"
                rm -rf "$b.tmp"
                echo "$b.tar regenerated"
@@ -64,13 +58,11 @@ tryat_done () {
 
 tryat () {
        local b="$1"
-       local i="${b##*/}"
-       case "$i" in *_*.git) i="${i%_*.git}.git";; esac
        if ! test -f "$b.tar" && ! test -f "$b.edit"; then
                return
        fi
-       tryat_pre "$b" "$i"
-       tryat_$mode "$b" "$i"
+       tryat_pre "$b"
+       tryat_$mode "$b"
        fail "unexpected situation in $b.*"
 }