diff options
2 files changed, 24 insertions, 6 deletions
| -rwxr-xr-x | scripts/archive | 15 | ||||
| -rwxr-xr-x | scripts/unarchive | 15 |
diff --git a/scripts/archive b/scripts/archive index 8d2f2d3..b75feb7 100755 --- a/scripts/archive +++ b/scripts/archive @@ -7,7 +7,7 @@ then set "$REPLY" fi -set "$(echo -e "a\n$1\n.\n1s|\.\+/||g\n1s|/\+|/|g\n1p\nQ" | ed -sqr | tail -1)" +set "$(echo -e "a\n$1/\n.\n1s|\.\+/||g\n1s|/\+|/|g\n1p\nQ" | ed -sqr | tail -1)" if [ ! -d "$1" ] then @@ -15,11 +15,20 @@ then exit 1 fi +set "${1%%/objects/*}" +set "${1%%/refs/*}" + __rec_ro() { while read -r f do - chwrite -w "$1/$f" - [ -d "$1/$f" ] && __rec_ro "$1/$f" + if [ -n "$f" ] + then + chwrite -w "$1/$f" + if [ -d "$1/$f" ] + then + __rec_ro "$1/$f" + fi + fi done <<FILES $(ls -A1 "$1") FILES diff --git a/scripts/unarchive b/scripts/unarchive index 7004888..4e12859 100755 --- a/scripts/unarchive +++ b/scripts/unarchive @@ -7,7 +7,7 @@ then set "$REPLY" fi -set "$(echo -e "a\n$1\n.\n1s|\.\+/||g\n1s|/\+|/|g\n1p\nQ" | ed -sqr | tail -1)" +set "$(echo -e "a\n$1/\n.\n1s|\.\+/||g\n1s|/\+|/|g\n1p\nQ" | ed -sqr | tail -1)" if [ ! -d "$1" ] then @@ -15,11 +15,20 @@ then exit 1 fi +set "${1%%/objects/*}" +set "${1%%/refs/*}" + __rec_ro() { while read -r f do - chwrite +w "$1/$f" - [ -d "$1/$f" ] && __rec_ro "$1/$f" + if [ -n "$f" ] + then + chwrite +w "$1/$f" + if [ -d "$1/$f" ] + then + __rec_ro "$1/$f" + fi + fi done <<FILES $(ls -A1 "$1") FILES |
