corpus icon indicating copy to clipboard operation
corpus copied to clipboard

Cannot open Corpus if first file in list has been deleted without using git

Open mikepqr opened this issue 4 years ago • 4 comments

If you delete a file (not git rm, just regular rm) then you get an error ("Can't open file") on the statusline when you select it in Corpus.

But if you delete the first file in the list (i.e. the first lexographically in the directory) then you can't open Corpus at all. The error prevents the file list being shown.

Obviously the solution is not to delete stuff without using git, but the assumption that the output ofgit ls-files matches what's in the working copy seems very fragile, and there may be other of problems of this nature. Using rg doesn't seem like the worst idea in the world, even for CorpusDirectories that have autocommit = true.

mikepqr avatar Nov 15 '20 00:11 mikepqr

Sorry for opening all these issues btw! I'm very excited about this project! I've been waiting for years for a vim plugin that really gets why nvALT is so great. Thank you for releasing it!

mikepqr avatar Nov 15 '20 00:11 mikepqr

Sorry for opening all these issues btw!

No harm done! Thanks for providing the feedback.

wincent avatar Nov 15 '20 16:11 wincent

Using rg doesn't seem like the worst idea in the world

Rather than assuming that people have rg installed (far fewer do than have git), I'd rather just exclude deleted files from the listing, which I can do by running git-ls-files with the -d/--deleted switch.

wincent avatar Nov 15 '20 17:11 wincent

I meant rg as a (fast!) example, but I do think it's worth whether it would be possible to use Corpus without tight coupling to git (not just the git command, but the creating and maintenance of a repository).

If you stick with ls-files then I think you need --other too, so that files created without autocommit=true (or files created outside vim even if autocommit=true) show up in the list.

mikepqr avatar Nov 16 '20 17:11 mikepqr