docs: def set_cached_commit_times(root_folder, parent_dir, first_commit, commit_times, sorted_relpaths):
      """
      Set the cached commit times in a json file at cache_location(root_folder)
  
      We first get what is currently in the cache and either modify the existing
      entry for this combo of parent_dir and sorted_relpaths.
  
      Or add to the entries.
  
      We then ensure there's less than 5 entries to keep the cache from growing
      too large (arbitrary number is arbitrary).
  
      Finally, we write the cache or issue a warning if we can't.
      """
      current = get_all_cached_commit_times(root_folder)
      location = cache_location(root_folder)
  
      found = False
      for item in current:
          if sorted(item.get("sorted_relpaths", [])) == sorted_relpaths and item.get("parent_dir") == parent_dir:
              item["commit_times"] = commit_times
              item["commit"] = str(first_commit)
              found = True
              break
  
      if not found:
          current.append({"commit": str(first_commit), "parent_dir": parent_dir, "commit_times": commit_times, "sorted_relpaths": sorted_relpaths})
  
      # Make sure it doesn't grow too big....
      # Arbitrary number is arbitrary
      while len(current) > 5:
          current.pop(0)
  
      try:
          log.info("Writing gitmit cached commit_times\tlocation=%s", location)
          with open(location, "w") as fle:
              json.dump(current, fle)
      except (TypeError, ValueError, IOError) as error:
          log.warning("Failed to dump gitmit mtime cache\tlocation=%s\terror=%s", location, error)