diff options
-rwxr-xr-x | git-maintenance/store.sh | 9 |
1 files 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)" |