From d3a28c07ba52c517a44cb5d34089bf7d05d7b190 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Sat, 13 Nov 2021 22:05:16 +0100 Subject: actually put UID into files --- alpine-to-carddav | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'alpine-to-carddav') diff --git a/alpine-to-carddav b/alpine-to-carddav index c9338fb..0766f35 100755 --- a/alpine-to-carddav +++ b/alpine-to-carddav @@ -67,7 +67,7 @@ git -C "${git_dir}" diff -U0 -- addressbook \ removals=false ;; '+'*) - last_uid="${last_uids[${#last_uids[@]}]}" + newUID="${last_uids[${#last_uids[@]}]}" mapfile -t last_uids < <( printf '%s\n' "${last_uids[@]}" \ | sed '$d' @@ -79,26 +79,26 @@ git -C "${git_dir}" diff -U0 -- addressbook \ date -u -Iseconds \ | sed 's@+00:00$@Z@' ) - if [ -z "${last_uid}" ]; then + if [ -z "${newUID}" ]; then if ${removals}; then >&2 printf 'There were more addresses added than removed.\n' exit 1 fi - last_uid=$(uuidgen) - printf '%s\t%s\n' "${last_uid}" "${line#+}" \ + newUID=$(uuidgen) + printf '%s\t%s\n' "${newUID}" "${line#+}" \ >> "${git_dir}/uids" - print_cnt 'new' > "${git_dir}/${last_uid}.vcs" + print_cnt 'new' > "${git_dir}/${newUID}.vcs" else read_line 'old' < <( sed ' - s/^'"${last_uid}"'\t// + s/^'"${newUID}"'\t// t d ' "${git_dir}/uids" ) sed -i ' - /^'"${last_uid}"'\t/ { - i '"${last_uid}$(printf '\t')${line#+}"' + /^'"${newUID}"'\t/ { + i '"${newUID}$(printf '\t')${line#+}"' d } ' "${git_dir}/uids" -- cgit v1.2.3-70-g09d2