From 99ddecacdbccd32dae5f99e2269eea9415026b6a Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Sat, 13 Nov 2021 22:05:32 +0100 Subject: vcs -> vcf --- alpine-to-carddav | 12 ++++++------ carddav-to-alpine | 4 ++-- common | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/alpine-to-carddav b/alpine-to-carddav index 0766f35..5d2938f 100755 --- a/alpine-to-carddav +++ b/alpine-to-carddav @@ -6,7 +6,7 @@ if [ -z "$(git -C "${git_dir}" diff)" ]; then exit fi -find_vcs \ +find_vcfs \ | while read -r file; do if [ ! -f "${file}" ]; then >&2 printf 'File "%s" is in git, but not in the worktree.\n' "${file##*/}" @@ -61,7 +61,7 @@ git -C "${git_dir}" diff -U0 -- addressbook \ '@@ '*) for last_uid in "${last_uids[@]}"; do sed -i '/^'"${last_uid}"'\s/d' "${git_dir}/uids" - rm "${git_dir}/${last_uid}.vcs" + rm "${git_dir}/${last_uid}.vcf" done last_uids=() removals=false @@ -87,7 +87,7 @@ git -C "${git_dir}" diff -U0 -- addressbook \ newUID=$(uuidgen) printf '%s\t%s\n' "${newUID}" "${line#+}" \ >> "${git_dir}/uids" - print_cnt 'new' > "${git_dir}/${newUID}.vcs" + print_cnt 'new' > "${git_dir}/${newUID}.vcf" else read_line 'old' < <( sed ' @@ -106,10 +106,10 @@ git -C "${git_dir}" diff -U0 -- addressbook \ if eval '[ "${old'"${key}"'}" != "${new'"${key}"'}" ]'; then for insert in "${key}:" 'VERSION:' 'BEGIN:VCARD$' ''; do if [ -z "${insert}" ]; then - >&2 printf 'Cannot find any place to insert into "%s".\n' "${uid}.vcs" + >&2 printf 'Cannot find any place to insert into "%s".\n' "${uid}.vcf" exit 1 fi - if ! grep -q '^'"${insert}" "${git_dir}/${uid}.vcs"; then + if ! grep -q '^'"${insert}" "${git_dir}/${uid}.vcf"; then continue fi if [ "${insert}" = "${key}:" ]; then @@ -128,7 +128,7 @@ git -C "${git_dir}" diff -U0 -- addressbook \ '"${insert_command}"' '"${delete_command}"' } - ' "${git_dir}/${uid}.vcs" + ' "${git_dir}/${uid}.vcf" break done fi diff --git a/carddav-to-alpine b/carddav-to-alpine index 5926ac3..85cffd8 100755 --- a/carddav-to-alpine +++ b/carddav-to-alpine @@ -13,10 +13,10 @@ for file in 'addressbook' 'uids'; do touch "${git_dir}"'/'"${file}" done -find_vcs \ +find_vcfs \ | while read -r address_file; do uid="${address_file##*/}" - uid="${uid%.vcs}" + uid="${uid%.vcf}" for key in "${keys[@]}"; do eval 'unset _'"${key}" diff --git a/common b/common index 6c7db2f..7dfc7dc 100644 --- a/common +++ b/common @@ -14,19 +14,19 @@ keys=( 'REV' ) -find_vcs() { +find_vcfs() { { find "${git_dir}" \ -name '.git' \ -prune \ , \ -type f \ - -name '*.vcs' \ + -name '*.vcf' \ -printf '%p\n' git -C "${git_dir}" archive HEAD \ | tar -t \ | sed ' - /\.vcs$/!d + /\.vcf$/!d s@^@'"${git_dir%/}"'/@ ' } \ -- cgit v1.2.3-54-g00ecf