dot

packages and services management
Log | Files | Refs | README

commit 3f785ddd0ace1f008a85e79e88dade48420b5b7c
parent 71d01b42e7cefdeebe219cf750dfe1d2ab43c6b6
Author: josuah <mail@josuah.net>
Date:   Fri,  6 Jan 2017 11:03:42 +0100

Speeding up new revision generation by parallell copy and hashing

Diffstat:
M.local/bin/version | 26+++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/.local/bin/version b/.local/bin/version @@ -60,24 +60,20 @@ new() printf 'making a new revision\n' find . -type f $(exclude .git .version) -print0 | sort -z | - xargs -0 md5sum > .version/tmp || die 'hashing error' - - hash="$(md5sum .version/tmp)" && hash="${hash%% *}" || exit 1 - [ -f .version/history ] && old="$(tail -n 1 .version/history)" || old='' - printf '1 %s\n2 %s\n' "$old" "$hash" - - mv -f .version/tmp ".version/rev/$hash" - - [ -f .version/history ] && [ "$hash" = "$old" ] || - printf '%s\n' "$hash" >> .version/history - - while read -r hash path + xargs -0 md5sum | tee -a .version/tmp | while read -r hash path do - [ -f ".version/obj/$hash" ] || - cp -f "$path" ".version/obj/$hash" - done < ".version/rev/$hash" + [ -f ".version/obj/$hash" ] || cp "$path" ".version/obj/$hash" + done chmod -w .version/obj/* .version/rev/* + + new="$(md5sum .version/tmp)" && new="${new%% *}" || exit 1 + mv -f .version/tmp ".version/rev/$new" + + [ -f .version/history ] && old="$(tail -n 1 .version/history)" || old='' + [ -f .version/history ] && [ "$new" = "$old" ] || + printf '%s\n' "$new" >> .version/history + printf 'old %s\nnew %s\n' "$old" "$new" }