diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-03-14 22:26:05 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-03-14 22:26:05 -0400 |
commit | 6d386c6cfe3d04a3188b9d05b7656ffec2a8f51f (patch) | |
tree | 96764b24c8cf130d25ddfbcea3adc1b2293f0fa5 /modules/blobs | |
parent | 7190864de465c3c3b015540ca45c9d9bccb5b790 (diff) |
fixity fix
Diffstat (limited to 'modules/blobs')
-rw-r--r-- | modules/blobs/Makefile.inc.mk | 4 | ||||
-rw-r--r-- | modules/blobs/_shlib.sh.m4 | 6 | ||||
-rw-r--r-- | modules/blobs/get.f.sh | 4 | ||||
-rw-r--r-- | modules/blobs/put.d.sh (renamed from modules/blobs/commit.d.sh) | 10 | ||||
-rw-r--r-- | modules/blobs/put.f.sh (renamed from modules/blobs/commit.f.sh) | 4 | ||||
-rw-r--r-- | modules/blobs/put.l.sh (renamed from modules/blobs/commit.l.sh) | 6 | ||||
-rw-r--r-- | modules/blobs/put.sh (renamed from modules/blobs/commit.sh) | 6 | ||||
-rw-r--r-- | modules/blobs/tree.sh | 27 |
8 files changed, 36 insertions, 31 deletions
diff --git a/modules/blobs/Makefile.inc.mk b/modules/blobs/Makefile.inc.mk index 484da13..2f91acd 100644 --- a/modules/blobs/Makefile.inc.mk +++ b/modules/blobs/Makefile.inc.mk @@ -1,5 +1,5 @@ -am_src_files += commit.d.sh commit.f.sh commit.l.sh commit.sh get.d.sh get.f.sh get.l.sh get.sh tree.sh init.sh -am_out_files += commit.d commit.f commit.l commit get.d get.f get.l.sh get tree init +am_src_files += put.d.sh put.f.sh put.l.sh put.sh get.d.sh get.f.sh get.l.sh get.sh tree.sh init.sh +am_out_files += put.d put.f put.l put get.d get.f get.l.sh get tree init am_src_files += _shlib.sh.m4 am_clean_files += _shlib.sh diff --git a/modules/blobs/_shlib.sh.m4 b/modules/blobs/_shlib.sh.m4 index 567486f..b58a20d 100644 --- a/modules/blobs/_shlib.sh.m4 +++ b/modules/blobs/_shlib.sh.m4 @@ -35,13 +35,13 @@ usage() { local form local pfix1="$(_ 'Usage:')" local pfix2="$(_ ' Or:')" - local pfix="pfix1" + local pfix="$pfix1" for form in "${usage[@]}"; do - printf '%s %q %q %s\n' "$pfix" "$RVS" "$form" + printf '%s %q %q %s\n' "$pfix" "$RVS" "${0##*/}" "$form" pfix="$pfix2" done - printf '%s\n' "$(_ "$desc")" if [[ -n "$doc" ]] && [[ "$volume" != '-q' ]]; then + printf '%s\n' "$(_ "$desc")" printf '\n\n%s\n' "$(_ "$doc")" fi } diff --git a/modules/blobs/get.f.sh b/modules/blobs/get.f.sh index fafb076..7cc49c6 100644 --- a/modules/blobs/get.f.sh +++ b/modules/blobs/get.f.sh @@ -19,7 +19,7 @@ license='AGPLv3+' # along with this program. If not, see <http://www.gnu.org/licenses/>. usage="ID FILENAME" -doc="Unlike commit.f, FILENAME may be a character device such as +doc="Unlike put.f, FILENAME may be a character device such as /dev/stdout or /dev/fd/n." . "${0%/*}/_shlib.sh" @@ -29,7 +29,7 @@ main() { name=$2 mkdir -p -- "$(dirname -- "$name")" - < "$REPO/blobs/${id#*:}" gunzip > "$name" + < "$RVS_REPO/blobs/${id#*:}" gunzip > "$name" } main "$@" diff --git a/modules/blobs/commit.d.sh b/modules/blobs/put.d.sh index 458f98e..afd5e7d 100644 --- a/modules/blobs/commit.d.sh +++ b/modules/blobs/put.d.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -name=blobs/commit.d -desc='Add a directory to the repository' +name=blobs/put.d +desc='Put a directory into the repository' copyright=('2009-2010, 2015-2016 Luke Shumaker') license='AGPLv3+' # This file is part of rvs. @@ -34,12 +34,12 @@ main() { if [[ "$RVS_REPO" -ef "$file" ]]; then continue fi - id="$("$RVS" commit "$file" 2>/dev/null)" - stat -c $'%a\t%u (%U)\t%g (%G)\t' -- "$file" + id="$("$RVS" blobs/put "$file")" + stat --printf $'%a\t%u (%U)\t%g (%G)\t' -- "$file" printf $'%s\t%s\n' "$id" "$file" done > "$tmpfile" ) - "$RVS" commit.f "$tmpfile" 'd' + "$RVS" blobs/put.f "$tmpfile" 'd' } main "$@" diff --git a/modules/blobs/commit.f.sh b/modules/blobs/put.f.sh index 233f7bb..01b421a 100644 --- a/modules/blobs/commit.f.sh +++ b/modules/blobs/put.f.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -name=blobs/commit.f -desc='Add a plain file to the repository' +name=blobs/put.f +desc='Put a plain file into the repository' copyright=('2009-2010, 2015-2016 Luke Shumaker') license='AGPLv3+' # This file is part of rvs. diff --git a/modules/blobs/commit.l.sh b/modules/blobs/put.l.sh index 54a2527..b3bc7e3 100644 --- a/modules/blobs/commit.l.sh +++ b/modules/blobs/put.l.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -name=blobs/commit.l -desc='Add a symbolic link to the repository' +name=blobs/put.l +desc='Put a symbolic link into the repository' copyright=('2016 Luke Shumaker') license='AGPLv3+' # This file is part of rvs. @@ -28,7 +28,7 @@ main() { tmpfile="$(mktemp -t "${0##*/}.XXXXXXXXXX")" trap 'rm -f -- "$tmpfile"' EXIT readlink -n -- "$link" > "$tmpfile" - "$RVS" commit.f "$tmpfile" 'l' + "$RVS" blobs/put.f "$tmpfile" 'l' } main "$@" diff --git a/modules/blobs/commit.sh b/modules/blobs/put.sh index 44a2465..c92f161 100644 --- a/modules/blobs/commit.sh +++ b/modules/blobs/put.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -name=blobs/commit -desc='Add files to the repository' +name=blobs/put +desc='Put files into the repository' copyright=('2009-2010, 2015-2016 Luke Shumaker') license='AGPLv3+' # This file is part of rvs. @@ -41,7 +41,7 @@ main() { else error 'File has unsupported file type: %s' "$file" fi - "$RVS" "commit.$type" "$file" + "$RVS" "blobs/put.$type" "$file" done } diff --git a/modules/blobs/tree.sh b/modules/blobs/tree.sh index f08db42..3953219 100644 --- a/modules/blobs/tree.sh +++ b/modules/blobs/tree.sh @@ -25,10 +25,10 @@ main() { local id name prefix has_prefix last case $# in 0) errusage;; - 1) id=$1; name=.;; - 2) id=$1; name=$2;; prefix=''; has_prefix=false;; - 3) id=$1; name=$2;; prefix=$3; has_prefix=true;; - 3) id=$1; name=$2;; prefix=$3; has_prefix=true; last=$4;; + 1) id=$1; name=. ; prefix=''; has_prefix=false; last='';; + 2) id=$1; name=$2; prefix=''; has_prefix=false; last='';; + 3) id=$1; name=$2; prefix=$3; has_prefix=true ; last='';; + 4) id=$1; name=$2; prefix=$3; has_prefix=true ; last=$4;; *) errusage;; esac @@ -37,10 +37,12 @@ main() { a='├── ' b='│ ' c='└── ' + d=' ' else a='|-- ' b='| ' c='`-- ' + d=' ' fi local pfix_self pfix_chld @@ -48,25 +50,28 @@ main() { pfix_self='' pfix_chld='' else - pfix_self="$prefix$a" - pfix_chld="$prefix$b" - if [[ -n "$last" ]]; then + if [[ -z "$last" ]]; then + pfix_self="$prefix$a" + pfix_chld="$prefix$b" + else pfix_self="$prefix$c" + pfix_chld="$prefix$d" fi fi printf "%s$(_ '%s\t(%s)')\n" "$pfix_self" "$name" "$id" if [[ "$id" == d:* ]]; then local lastname - lastname="$("$RVS" get.d "$id" /dev/stdout | sed -n '$/.*\t//p')" + lastname="$("$RVS" blobs/get.f "$id" /dev/stdout| sed -n $'$s/.*\t//p')" local perm user group id name + IFS=$'\t' while read -r perm user group id name; do if [[ "$name" != "$lastname" ]]; then - "$RVS" tree "$id" "$name" "$pfix_chld" + "$RVS" blobs/tree "$id" "$name" "$pfix_chld" else - "$RVS" tree "$id" "$name" "$pfix_chld" t + "$RVS" blobs/tree "$id" "$name" "$pfix_chld" t fi - done < <("$RVS" get.d "$id" /dev/stdout) + done < <("$RVS" blobs/get.f "$id" /dev/stdout) fi } |