diff options
-rwxr-xr-x | carddav-to-alpine | 8 | ||||
-rw-r--r-- | common | 19 |
2 files changed, 20 insertions, 7 deletions
diff --git a/carddav-to-alpine b/carddav-to-alpine index 4ed3550..5926ac3 100755 --- a/carddav-to-alpine +++ b/carddav-to-alpine @@ -13,13 +13,7 @@ for file in 'addressbook' 'uids'; do touch "${git_dir}"'/'"${file}" done -find "${git_dir}" \ - -name '.git' \ - -prune \ - , \ - -type f \ - -name '*.vcs' \ - -printf '%p\n' \ +find_vcs \ | while read -r address_file; do uid="${address_file##*/}" uid="${uid%.vcs}" @@ -17,6 +17,25 @@ gen_rev() { )" } +find_vcs() { + { + find "${git_dir}" \ + -name '.git' \ + -prune \ + , \ + -type f \ + -name '*.vcs' \ + -printf '%p\n' + git -C "${git_dir}" archive HEAD \ + | tar -t \ + | sed ' + /\.vcs$/!d + s@^@'"${git_dir%/}"'/@ + ' + } \ + | sort -u +} + git_dir="$1" if [ ! -d "${git_dir}" ]; then |