llimllib / git-ls

The Unlicense
4 stars 0 forks source link

maintain a last-modified index #5

Open llimllib opened 4 months ago

llimllib commented 4 months ago

git-ls is slow because it takes a long time for git to tell us when each file was last modified.

If I stored an index of file -> mtime, and also the hash of the most recent commit where it was valid, then getting mtimes could follow this process:

  1. If the current hash is the same as the stored last index, use the indexed mtimes
  2. Otherwise: i. simple solution: invalidate the whole cache and recalculate mtimes ii. maybe faster solution: check commits from the last cache to current HEAD, update the mtimes of all files touched by those commits