Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
714 B

  1. #!/usr/bin/env bash
  2. shopt -s nullglob
  3. cache_dir=$(clipctl cache-dir)
  4. cache_file=$cache_dir/line_cache
  5. declare -A cksums
  6. while IFS= read -r line; do
  7. cksum=$(cksum <<< "$line")
  8. cksums["$cksum"]="$line"
  9. # Are all cache entries represented by a file?
  10. full_file=$cache_dir/$cksum
  11. if ! [[ -f $full_file ]]; then
  12. printf 'cache entry without file: %s -> %s\n' "$line" "$full_file" >&2
  13. fi
  14. done < <(cut -d' ' -f2- < "$cache_file")
  15. # Are all files represented by a cache entry?
  16. for file in "$cache_dir"/[012346789]*; do
  17. cksum=${file##*/}
  18. line=${cksums["$cksum"]-_missing_}
  19. if [[ $line == _missing_ ]]; then
  20. printf 'file without cache entry: %s\n' "$file"
  21. fi
  22. done