From 739f7227a94a909feddc2f4bfe7eb642df6152dd Mon Sep 17 00:00:00 2001 From: olpc user Date: Fri, 10 Jan 2020 08:56:26 -0800 Subject: fix bug preventing upload, attempt --- git-maintenance/store.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/git-maintenance/store.sh b/git-maintenance/store.sh index f40dfb7..8dba270 100755 --- a/git-maintenance/store.sh +++ b/git-maintenance/store.sh @@ -67,20 +67,25 @@ for packfile in objects/pack/*.pack do $TAR -cv "$packfile" > "$tmpfile" fn="$({ cat "$packfile"; echo -n "$RESPECT"; } | sha256sum | cut -f 1 -d ' ')".aes + skipmove=0 if [ -e encrypted/"$fn" ] then echo "$fn ALREADY EXISTS LOCALLY ($packfile)" if [ "$(cat "$packfile" | sha256sum)" = "$(decrypt < encrypted/"$fn" | $TAR -xvOf - "$packfile" | sha256sum)" ] then echo "$fn MATCHES CONTENT LOCALLY ($packfile)" + skipmove=1 else echo "$fn DOESN'T MATCH LOCAL CONTENT ($packfile)" - encrypt < "$tmpfile" > "$tmpfile".aes - mv "$tmpfile".aes encrypted/"$fn" fi else echo "$fn IS NEW LOCALLY ($packfile)" fi + if ! (( skipmove )) + then + encrypt < "$tmpfile" > "$tmpfile".aes + mv "$tmpfile".aes encrypted/"$fn" + fi # need to decrypt to compare content. if [ "$(curl "$URLPFX"/"$fn" | decrypt | $TAR -xvOf - "$packfile" | sha256sum)" = "$(cat "$packfile" | sha256sum)" ]; then echo "$fn MATCHES DOWNLOAD CONTENT ($packfile)" -- cgit v1.2.3