Sublime-Executor icon indicating copy to clipboard operation
Sublime-Executor copied to clipboard

Use Git-native gitignore handling

Open kytta opened this issue 1 year ago • 1 comments

Closes #1

This PR makes some changes to how executables are discovered:

  • all workspace folders get processed one after the other. For each folder:
    • if git executable is in $PATH AND if the current folder is [in] a repo:
      • use git ls-files to find all executables inside the repo
    • if current folder is not in a Git repo or there is no git
      • use os.walk and check every file for executability
      • directories named .git are always ignored

This adds some breaking changes, namely:

  • if Git is not available, .gitignore is not taken into account any more
    • I believe this makes sense, as you wouldn't really work with a Git-powered repo without Git available
  • the methods counting the executables are generator functions (may speed things up)

TODO:

  • [x] update docs

kytta avatar Sep 22 '24 19:09 kytta

It is absolutely possible to work with git without having git installed. Some GUI clients ship with their own version of git that isn’t exposed. Git might not be on a PATH from Sublime env but on a PATH with interactive REPL.

We might want to find untracked files too (user created a file but didn’t make a commit yet)

We can use git if present (with the change for untracked files) and fall back to current impl if not found.

tonsky avatar Sep 23 '24 16:09 tonsky